mirror of
https://github.com/vercel/next.js.git
synced 2026-09-20 02:25:18 +08:00
26b2bbe024
Verify locally:
- Copy the example to a local directory
- Install deps
- docker compose up -d
- npm run build && npm run start
- navigate to localhost:3000/cet (or gmt)
- open the Redis view (link in localhost:3000/cet)
- revalidate data on /cet or /gmt
- verify it on the Redis view
I had to update the app to async params, updateTag, and write the
handler in such a way that it solved:
```
⨯ TypeError: p.segmentData.get is not a function
at ignore-listed frames
⨯ Error: failed to pipe response
```
Also adding docs edits with this caveat.
An agent review, and cross checking with a community implementation,
surfaced, that we had to read tags from
`data.headers['x-next-cache-tags']`. This agent review added a few
comments, I think they are useful, but can cut down if needed.
Last but not least, had to update the Time API endpoint (former no
longer worked).
26 lines
917 B
JavaScript
26 lines
917 B
JavaScript
/** @type {import('next').NextConfig} */
|
|
const nextConfig = {
|
|
// Enable Cache Components so the `'use cache: remote'` directive is available.
|
|
cacheComponents: true,
|
|
// The singular `cacheHandler` backs the ISR/incremental cache (pages, route
|
|
// handlers, images).
|
|
cacheHandler:
|
|
process.env.NODE_ENV === "production"
|
|
? require.resolve("./cache-handler.js")
|
|
: undefined,
|
|
// The plural `cacheHandlers` back the `'use cache'` family. Here the `remote`
|
|
// handler stores `'use cache: remote'` entries in the same Redis instance.
|
|
cacheHandlers: {
|
|
remote: require.resolve("./remote-cache-handler.js"),
|
|
},
|
|
// Disable the default in-memory cache so Redis is the single shared source
|
|
// of truth across instances.
|
|
cacheMaxMemorySize: 0,
|
|
env: {
|
|
NEXT_PUBLIC_REDIS_INSIGHT_URL:
|
|
process.env.REDIS_INSIGHT_URL ?? "http://localhost:8001",
|
|
},
|
|
};
|
|
|
|
module.exports = nextConfig;
|