The documentation on caching in the Federation page talks about the @cacheControl directive and the values for Cache-Control header it sets from various subgraphs. I am confused as to how to actually implement caching when using the Apollo Gateway with Federation 1. I should note that I’m using the Netflix DGS library for my subgraph APIs . DGS does not support APQ. It also does not support the @cacheControl directive, but the feature request was just merged yesterday so its imminent.
Since the ApolloGateway takes an ApolloServer object, I was hoping to use the Memcache or Redis as described here to cache the subgraph responses, but it does not appear to be doing anything when the ApolloServer is configured to use it.
The only way I could figure out how to get it to work is to create a custom RemoteGraphQLDataSource with a custom fetcher that integrates with my external cache. Is there a simpler/better way?