Rendering
use cache: private
With Cache Components enabled, use cache: private permits selected request APIs inside the cached scope. It does not create shared server-side cache entries. Treat its lifecycle and browser reuse limits as release-specific, and never rely on it for identity or authorization. This example reads only a harmless display preference and does not access private records. Source: https://nextjs.org/docs/app/api-reference/directives/use-cache-private. Documentation-reviewed illustrative draft; installed declarations and runtime not verified.
Formal Syntax & Structure
nextjs syntaxnextjs
'use cache: private'Working Example
Example Snippetnextjs
import {cookies} from 'next/headers';import {cacheLife} from 'next/cache';export async function DisplayMode(){ 'use cache: private'; cacheLife({stale:60}); const mode=(await cookies()).get('view')?.value==='compact'?'compact':'standard'; return <p>Display mode: {mode}</p>;}