Files
Niklas MischkulnigandGitHub 07f76411b0 Include deployment id in cacheHandlers keys (#93453)
How was this ever working for dev? In that case, `buildId =
"development"` and so it always uses the same cache key
2026-05-04 18:26:07 +02:00

22 lines
577 B
TypeScript

import { Suspense } from 'react'
import { cacheLife } from 'next/cache'
// The id prop is just used to assert on the logged cache key in tests.
async function DynamicCache({ id }: { id: string }) {
'use cache'
cacheLife('seconds')
return <p id="data">{new Date().toISOString()}</p>
}
export default function Page() {
return (
<p>
This page uses a short-lived "use cache", which is omitted from the
prerender, but should still be saved in the cache handler.
<Suspense>
<DynamicCache id="dynamic-cache" />
</Suspense>
</p>
)
}