silverwolf-x's picture
download
raw
1.31 kB
export async function PrivateCachedData({
label,
cacheKey,
}: {
label: string
cacheKey: string
}) {
const data = await getPrivateCachedData(cacheKey)
console.log(`after private cache read - ${label}`)
return (
<dl>
<dt>Private Cached Data (Page)</dt>
<dd>{data}</dd>
</dl>
)
}
export async function SuccessivePrivateCachedData({
label,
cacheKey,
}: {
label: string
cacheKey: string
}) {
// This components tests if we correctly handle the case where resolving a cache
// reveals another cache in the children. When we're filling caches, we should fill both.
const data1 = await getPrivateCachedData(`${cacheKey}-successive-1`)
return (
<dl>
<dt>Private Cached Data (successive reads)</dt>
<dd>{data1}</dd>
<dd>
<SuccessivePrivateCachedDataChild label={label} cacheKey={cacheKey} />
</dd>
</dl>
)
}
async function SuccessivePrivateCachedDataChild({
label,
cacheKey,
}: {
label: string
cacheKey: string
}) {
const data2 = await getPrivateCachedData(`${cacheKey}-successive-2`)
console.log(`after successive private cache reads - ${label}`)
return <>{data2}</>
}
async function getPrivateCachedData(_key: string) {
'use cache: private'
await new Promise((r) => setTimeout(r))
return Math.random()
}

Xet Storage Details

Size:
1.31 kB
·
Xet hash:
3ea5d8b32f761e50c1733d891b02e997801c2627d7584e20799c2b0a5e66c391

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.