Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docs: Description of client-side cache time #49431

Closed
AkifumiSato opened this issue May 8, 2023 · 3 comments
Closed

Docs: Description of client-side cache time #49431

AkifumiSato opened this issue May 8, 2023 · 3 comments
Labels
Documentation Related to Next.js' official documentation. locked

Comments

@AkifumiSato
Copy link
Contributor

What is the improvement or update you wish to see?

I would like to see a description of when the client-side cache is reused and when it is expired.

Is there any context that might help us understand?

// if the cache entry was prefetched or read less than 30s ago, then we want to re-use it
if (Date.now() < (lastUsedTime ?? prefetchTime) + THIRTY_SECONDS) {
return lastUsedTime
? PrefetchCacheEntryStatus.reusable
: PrefetchCacheEntryStatus.fresh
}
// if the cache entry was prefetched less than 5 mins ago, then we want to re-use only the loading state
if (kind === 'auto') {
if (Date.now() < prefetchTime + FIVE_MINUTES) {
return PrefetchCacheEntryStatus.stale
}
}
// if the cache entry was prefetched less than 5 mins ago and was a "full" prefetch, then we want to re-use it "full
if (kind === 'full') {
if (Date.now() < prefetchTime + FIVE_MINUTES) {
return PrefetchCacheEntryStatus.reusable
}
}
return PrefetchCacheEntryStatus.expired

Does the docs page already exist? Please link to it.

https://nextjs.org/docs/app/building-your-application/routing/linking-and-navigating#client-side-caching-of-rendered-server-components

@AkifumiSato AkifumiSato added the Documentation Related to Next.js' official documentation. label May 8, 2023
@wscotten
Copy link

This would be extremely helpful to document explicitly. Having to dive into the code to see that it is 30 seconds is silly.

@AkifumiSato
Copy link
Contributor Author

Close as the document has been added.
#52514

@github-actions
Copy link
Contributor

This closed issue has been automatically locked because it had no new activity for 2 weeks. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 17, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Documentation Related to Next.js' official documentation. locked
Projects
None yet
Development

No branches or pull requests

2 participants