Replies: 2 comments 2 replies
-
Thanks for the suggestion @spurrkins. This is a really interesting topic that we haven't looked into much yet. |
Beta Was this translation helpful? Give feedback.
1 reply
-
Just wanted to echo @spurrkins opening comments. We've been looking into adding response caching with our Apollo Gateway recently and having support for the We'd be keen to contribute in any way that makes sense |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Out of the box support for federation is really helpful, and we're interested in having more support for the apollo ecosystem. In particular, caching. The federated gateway implementation will soon support aggregating cache hints from subgraphs out of the box (already works for standalone graphs), and being able to take advantage of that with dgs-implemented subgraphs would be great.
There are a couple components, each would be helpful:
Support for @CacheControl
This adds the ability to annotate the schema with information on how the data can be cached. Primarily, whether it is public or private, and what the max age is. If an attribute doesn't have an annotation, it's inferred to be uncacheable. Additionally, resolvers should be able to alter this at runtime.
When the query has been fully resolved, it should set a cache-control header with an aggregated, most-restrictive policy.
This alone would allow for integration with CDNs, and federated gateways could start managing their own full response cache.
Caching responses
This feature would begin enforcing the cache policies calculated above - when a response can be cached, it writes it to a cache keyed by something along the lines of the query hash, parameters, and clientId if it's private. Incoming queries check if the response already exists prior to resolving the response.
Interested in hearing if this is something already being considered!
Beta Was this translation helpful? Give feedback.
All reactions