title: How to setup server-side full response caching in Apollo Server
body: <p>I am trying to setup a cache according to <a href="https://www.apollographql.com/docs/apollo-server/features/caching/" rel="nofollow noreferrer">this guide</a> for one expensive query that has a result that changes only once a day. The query takes 7-8 seconds and most it is after the DB query, because the response returned from the resolver must be heavily processed. </p>
  
  <p>I am using <code>apollo-server-express</code> library and the change pluging is <code>apollo-server-plugin-response-cache</code>.</p>
  
  <p>This is what I have done:</p>
  
  <pre><code>server.js
  
  const { ApolloServer } = require('apollo-server-express')
  const responseCachePlugin = require('apollo-server-plugin-response-cache')
  
  const server = new ApolloServer({
    typeDefs,
    resolvers,
    context: async ({ req }) =&gt; {
      // ...
    },
    plugins: [responseCachePlugin()]
  </code></pre>
  
  <pre><code>resolvers.js
  
  personDetails: async (root, args, ctx, info) =&gt; {
        info.cacheControl.setCacheHint({ maxAge: 600 })
        const persons = await Person.find({}).populate('details')
  
        // processing the data
  
        return processedData
  }
  </code></pre>
  
  <p>I expect the resolver to run once and then after that the response should be returned from the cache almost instantly. This doesn't work. I am doing something wrong or I haven't understood how this should work.</p>
  
  <p>I tried to put cache hints also in the schema, but didn't get any better results.</p>