"use cache" in Canary to support custom keys #75084
daveycodez
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Goals
I noticed that unlike unstable_cache, "use cache" doesn't allow you to set your custom keys.
What if I want to have 2 separate functions that share the same cache key? I might have pre-cached data I want to load into the cache in order to skip a database request, for example:
/posts page loads all posts.
I want to loop through each post and pre-fill the cache for /post/post_id with each post JSON object from this parent object, so when the prefetches to each /post/post_id fire off, they don't request by database and instead use the cache key I have preloaded with data.
Background
unstable_cache vs use cache
Proposal
Please support setting cache keys for "use cache" or do not deprecate unstable_cache so we can continue to use it that way in future releases
Beta Was this translation helpful? Give feedback.
All reactions