I have a requirement to cache the responses to a new graphql query added to our exising schema. From reading the docs at: apollo docs. I can see that I need to do one of two things:
- statically add a schema hint to the query in the schema:
type Query { latestPost: Post @cacheControl(maxAge: 10) }
- use a plugin like 'apollo-server-plugin-response-cache' to save full responses to a cache. see here
What I can't see, is the differences between these two implementations, or why I would pick one over the other.
Cache will be running in fargate, so no sharing across instances.
Is it how if I use the second method, the responses to all queries will be cached? I can't see any additional indicator inthe docs to say which particuar queries should be cached, once the plugin is imported.