mirror of
https://github.com/hanzoai/next.js.git
synced 2026-10-30 14:46:38 +00:00
33 lines
831 B
TypeScript
33 lines
831 B
TypeScript
import { Suspense } from 'react'
|
|
import { cacheLife } from 'next/cache'
|
|
|
|
export default function Page() {
|
|
return (
|
|
<main>
|
|
<p>
|
|
Caches that use the 'seconds' profile will be omitted from static
|
|
prerenders, making this essentially dynamic. If we omit it, it should
|
|
not affect the cache life of the prerender.
|
|
</p>
|
|
<Suspense fallback="Loading...">
|
|
<ShortLivedContent />
|
|
</Suspense>
|
|
<br />
|
|
<p>Longer lived caches should still affect the cache life of the page.</p>
|
|
<LongerLivedContent />
|
|
</main>
|
|
)
|
|
}
|
|
|
|
async function ShortLivedContent() {
|
|
'use cache'
|
|
cacheLife('seconds')
|
|
return <div>Short-lived cached content</div>
|
|
}
|
|
|
|
async function LongerLivedContent() {
|
|
'use cache'
|
|
cacheLife('minutes')
|
|
return <div>Longer-lived cached content</div>
|
|
}
|