-
Couldn't load subscription status.
- Fork 29.7k
docs: cacheHandlers #85311
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
base: canary
Are you sure you want to change the base?
docs: cacheHandlers #85311
Conversation
|
|
||
| Custom handlers are also useful for: | ||
|
|
||
| - Persistent cache across deployments |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking into it! Thanks for the input!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We'd love to be able to do this, don't get me wrong. I guess someone could parse the key and work around it, but keys are supposed to be opaque and understandably so.
It's a great to have feature, until it isn't (schema changes).
In an ideal world, instead of namespacing by build id another concept could be introduced. Maybe a "schema version". Cached data could then be safely shared across deployments.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So I was reading a bit and the reason is
next.js/packages/next/src/server/use-cache/use-cache-wrapper.ts
Lines 991 to 995 in 498349c
| // Because the Action ID is not yet unique per implementation of that Action we can't | |
| // safely reuse the results across builds yet. In the meantime we add the buildId to the | |
| // arguments as a seed to ensure they're not reused. Remove this once Action IDs hash | |
| // the implementation. | |
| const buildId = workStore.buildId |
I'll update accordingly for now, but will check again w/ team on Monday.

No description provided.