mirror of
https://github.com/hanzoai/next.js.git
synced 2026-10-30 14:46:38 +00:00
13 lines
243 B
TypeScript
13 lines
243 B
TypeScript
import { cacheLife } from 'next/cache'
|
|
|
|
async function getCachedRandom() {
|
|
'use cache'
|
|
cacheLife('frequent')
|
|
return Math.random()
|
|
}
|
|
|
|
export default async function Page() {
|
|
const x = await getCachedRandom()
|
|
return <p id="x">{x}</p>
|
|
}
|