Caching at the component level
Next.js 16 introduces 'use cache' as a primitive that works on entire components and functions, not just fetch(). It replaces experimental unstable_cache with a cleaner directive-based API.
Three building blocks
| API | Use |
|---|---|
'use cache' | Mark a component or function as cacheable |
cacheLife(profile) | Set the cache duration (built-in profiles or custom) |
cacheTag(...tags) | Tag the cached output for on-demand invalidation |
Built-in cacheLife profiles
Use a profile name and the framework picks reasonable defaults: 'seconds', 'minutes', 'hours', 'days', 'weeks', 'max'. Custom profiles can set stale / revalidate / expire independently.
How it composes with PPR
'use cache' integrates with Partial Prerendering: cached components render at build time and become part of the static shell, while uncached parts stay dynamic in the same route.