app/private-cache/product/[id]/with-private/page.tsx
1async function getRecommendations(productId: string) {
3 cacheTag(`recommendations-${productId}`);
4 cacheLife({ stale: 60 });
6 // Can call cookies() INSIDE the cached function!
7 const sessionId = (await cookies()).get('session-id')?.value || 'guest';
9 return getPersonalizedRecommendations(productId, sessionId);
12async function Recommendations({ productId }: { productId: string }) {
13 // This will be runtime prefetched automatically
14 const recommendations = await getRecommendations(productId);
18 {recommendations.map((rec) => (
19 <ProductCard key={rec.id} product={rec} />
25export const unstable_prefetch = {
28 { params: { id: '1' }, cookies: [{ name: 'session-id', value: '1' }] },