Skip to content

Server-side shared query cache #998

Answered by Ephem
PepijnSenders asked this question in General
Discussion options

You must be logged in to vote

Thanks for the feedback, this is an interesting use case! So what you need is a way to keep track of which queries were fetched in this particular request so that you can dehydrate only those? Sounds like a very classic SSR problem. 😁

I think the solution you came up with is a good one. 😄 I guess what you could do to simplify it a bit is to wrap prefetchQuery with your own function that takes care of the requestLog-stuff behind the scenes.

A slightly different/expanded approach that could be generalized into a third party library would be to create a kind of full proxy for that shared cache, and in that proxy keep track of which queries has been accessed. Something like const proxyCache =…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@PepijnSenders
Comment options

Answer selected by Ephem
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants