use cache: private when you need to cache user-specific data that depends on cookies, headers, or search params.use cache, private caches can access request-specific APIs like cookies() and headers() directly inside the cached function.use cache: private, personalized content cannot be prefetched and must wait until navigation occurs.1async function getRecommendations(productId: string) {2'use cache: private';3cacheTag(`recommendations-${productId}`);4cacheLife({ stale: 60 });56// Can call cookies() INSIDE the cached function!7const sessionId = (await cookies()).get('session-id')?.value || 'guest';89return getPersonalizedRecommendations(productId, sessionId);10}1112async function Recommendations({ productId }: { productId: string }) {13// This will be runtime prefetched automatically14const recommendations = await getRecommendations(productId);1516return (17<div>18{recommendations.map((rec) => (19<ProductCard key={rec.id} product={rec} />20))}21</div>22);23}2425export const unstable_prefetch = {26mode: 'runtime',27samples: [28{ params: { id: '1' }, cookies: [{ name: 'session-id', value: '1' }] },29],30};
use cache: private to enable runtime prefetching. The content is still dynamic, but it's prefetched
when the static content of the page is also prefetched.use cache: private, meaning their recommendations will be loaded after navigation.use cache: private enables runtime prefetching of personalized content by allowing request-specific APIs inside cached functions.unstable_prefetch export using mode: 'runtime' and appropriate cacheLife settings.Private cache enables runtime prefetching for user-specific data.
| Topic | Guidance |
|---|---|
| Use case | Personalized data that still benefits from prefetch |
| Scope | Private caches never persist to shared cache handlers |
| UX | Makes dynamic content feel instant |


