`use cache` vs React `cache()` vs `unstable_cache` in Next.js
Three cache helpers with similar names and different jobs. Learn how use cache, React cache(), and unstable_cache differ in lifetime and persistence.
Full-stack React framework
Three cache helpers with similar names and different jobs. Learn how use cache, React cache(), and unstable_cache differ in lifetime and persistence.
Next.js 14 cached fetch by default, Next.js 15 stopped, and Next.js 16 keeps it uncached. Learn the per-version default and how to opt in.
The cacheLife function sets how long a cached function or component stays fresh, using the stale, revalidate, and expire timings.
A short cacheLife turns cached content into a dynamic hole instead of prerendered HTML. Learn the thresholds and how to keep your shell static.
The cacheTag function labels cached entries for on-demand invalidation. Learn how to tag data and purge it with updateTag or revalidateTag.
Both invalidate a cache tag, but updateTag expires data immediately while revalidateTag refreshes in the background. Learn which to call after a mutation.
revalidatePath invalidates cached data for a specific route. Learn the path and type parameters, page vs layout revalidation, and Server Action vs Route Handler behavior.
A cached scope must return the same result for everyone, so reading the request inside use cache fails. Learn the error and how to pass values in instead.
Revalidation updates cached data without dropping the cache. Learn time-based and on-demand revalidation, and what stale, revalidate, and expire mean.
Move off the deprecated unstable_cache wrapper and onto the use cache directive. Drop key parts, map options to cacheLife and cacheTag, and know the persistence change.
The previous caching model, for apps without cacheComponents. Learn fetch cache options, unstable_cache, and the route segment configs that control it.
What an App Shell is in Next.js 16, what ends up inside it, and how it gives every dynamic route an instant first paint.