Strapi GraphQL + Redis caching

Hey everyone!

I try to configure GraphQL queries caching by redefining ApolloServer parameters from my config directory:

apolloServer: {
  tracing: false,
  introspection: true,
  cache: new KeyvAdapter('redis://redis:6379'),
  cacheControl: {
    defaultMaxAge: 3600,
  },
}

But I don’t see any result of performance improvements or etc for queries like:

query Sth {
    articlePages(locale: "ru") {
    data {
      id
    }
  }
}

Additionally I tried to do the next hack:

articlePage: {
  resolve: async (parent, args, ctx, info) => {
    info.cacheControl.setCacheHint({ maxAge: 60, scope: 'PRIVATE' })

But all responses don’t have any cache headers and query resolvers execute on each call.

How can I configure query caching properly?

Thanks in advance!

This topic has been created from a Discord post (1260288722146951371) to give it more visibility.
It will be on Read-Only mode here.
Join the conversation on Discord

I found solution:

plugins: [ApolloServerPluginCacheControl({ defaultMaxAge: 60 }), responseCachePlugin()],

This approach requires to redefine ApolloServerPluginCacheControl with your defaultMaxAge ttl and responseCachePlugin for caching responses on backend side.