What problem does it solve?
It helps you improve performance in Next.js by letting you mix static, cached, and dynamic output within the same route, without relying on older experimental PPR options.
Core Features & Use Cases
- Enables Cache Components (Next.js 16+): Turn on
cacheComponents: true to replace legacy experimental.ppr and unlock Partial Prerendering behavior.
- Controls output freshness with
use cache: Cache async data using the use cache directive at file, component, or function level for fast repeat visits.
- Manages cache lifecycle and invalidation: Use
cacheLife() for staleness/revalidation/expiry control and cacheTag() with updateTag()/revalidateTag() for targeted cache invalidation.
- Handles runtime constraints: Prevent forbidden runtime API usage (like
cookies(), headers(), searchParams) inside use cache, with an escape hatch via use cache: private.
- Choose correct rendering strategy per data type: Combine auto-prerendered static segments, cached segments, and streamed dynamic segments via
Suspense.
Quick Start
Enable Cache Components by setting cacheComponents: true in your next.config.ts, then mark your async data functions with the use cache directive and tune their behavior using cacheLife() and cacheTag().