-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
InMemoryCache is not respecting the Cache-Control header #7796
Comments
@mathix420 For most issues folks are facing with Apollo Client 2, our general advice is to try updating to AC3. In this case, I have to admit updating to AC3 won't help, because Apollo Client (still) doesn't have any logic to handle If you update to AC3, https://github.com/NerdWalletOSS/apollo-invalidation-policies might give you some of the functionality you're looking for, though that won't be as automatic as what you described (which would be better, I agree). |
@danReynolds It seems like you've started to think about TTL with |
I'd have to dig into whether those headers are exposed in the cache APIs I'm using, if they are then I could see it being do-able although the way the current TTLs are set up by being specified on types I'd have to think about reconciling those two. Certainly something we can spike. |
Any update on this front? Does Apollo has any plans to get this in sometime soon? Or is there some suggested solution for now that can enable utilisation of cache-control headers for client's cache? Wondering how we handle possible conflicts between default & http caching then. @danReynolds Also, Could you make the above workaround work? |
Intended outcome:
I use
apollo-client
via@nuxtjs/apollo
which is usingvue-apollo
which is usingapollo-client
.I am using
InMemoryCache
to cache my queries in frontend.On server I use the
@cacheControl
directive to control the cache TTL.So I am assuming that
apollo-client
coupled withInMemoryCache
should take care of theCache-Control
header and invalidate cached queries once themax-age
has expired.Actual outcome:
If I retry a simple query returning this header
cache-control: max-age=100, public
100 seconds after the first one the cache is used, which is not intended.How to reproduce the issue:
--
Versions
The text was updated successfully, but these errors were encountered: