YP
Както так:
const { InMemoryLRUCache } = require('apollo-server-caching')
const responseCache = new InMemoryLRUCache()
const responseCachePlugin = require('apollo-server-plugin-response-cache')
const saerver = new ApolloServer({
plugins: [
responseCachePlugin({
cache: responseCache,
}),
],
context: req => ({
responseCache,
}),
resolvers: {
someMutation: (_, args, context) => {
context.responseCache.flush()
},
},
})