next.js
3ba45d2d - docs: describe use cache keys and persistence across deploys in 16.5 (#102726)

Commit
1 day ago
docs: describe use cache keys and persistence across deploys in 16.5 (#102726) ### What? Updates the `use cache` docs for the cache key used in 16.5. In Turbopack production builds the key is derived from the cached function's code, the Next.js version, and the runtime environment variables it reads, so entries in a durable cache handler can be reused by a new deploy. The build ID or `deploymentId` is only part of the key in development, with webpack, or when the cached code reads `process.env` dynamically. Touches the `use cache` and `use cache: remote` references, `unstable_cache`, `deploymentId`, the Getting Started caching page, and the Cache Components migration guide. ### Why? 16.5 enabled durable `use cache` entries by default (#101922), but the docs still said the build ID is always in the key and that entries never carry over to a new deploy. ### Verification - Checked each claim against `use-cache-wrapper.ts`, `work-store.ts`, `config.ts` and `crates/next-api/src/server_actions.rs` at `v16.5.0`. - `pnpm test-start-turbo test/production/app-dir/use-cache-cross-deployment/use-cache-cross-deployment.test.ts` (existing test, 27 passed and 3 skipped on canary: entries are reused across two deployments when nothing changes, and recomputed when the code or a read environment variable changes)
Author
Parents
Loading