Open evans opened 6 years ago
I could see myself having some sort of "lock" hint. To prevent cache dog-piling or cache stampede it may be beneficial for a lock hint to be added. I would like to specify a lock so it would not be possible for my apollo-server instances to be computing the same cache value on expiry. For my use case, I would like to see 1 apollo-server instance compute the cached value while every other apollo-server instance still serves the stale value. I am sure that case will not work for everyone though so perhaps there would need to be a few options that can be configured in the hint. Something like @lock(keepStale=true)
Great to see some traction for this so we can clean up the code.
From our experience, the most valuable would be the mentioned Vary
and Age
.
And also it would be great to add more functions to manage the cache hints programmatically. These are things which we are doing on top of current (v1) features
AST.cacheControl.mergeCacheHint(hint)
when we are hitting multiple backend services we need to merge multiple hints coming from there. In that case, we need to do a little trickery to achieve that.
Totally agree that it would be great to add some more features. Curious which you are interested in and how you might see them play out in the extensions?
@jakubriedl wrote in apollographql/apollo-cache-control-js/#18