Skip to content

Commit

Permalink
Example how to turn on application level cache (in-memory) (#9)
Browse files Browse the repository at this point in the history
  • Loading branch information
rudi23 authored and Wojciech Iskra committed Jun 25, 2019
1 parent 419ad34 commit 44939c8
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 11 deletions.
52 changes: 41 additions & 11 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
"apollo-link-http": "^1.5.14",
"apollo-link-persisted-queries": "^0.2.2",
"apollo-server-koa": "^2.6.3",
"apollo-server-plugin-response-cache": "^0.2.2",
"bunyan": "^1.8.12",
"dataloader": "^1.4.0",
"eslint-plugin-babel": "^5.3.0",
Expand Down
2 changes: 2 additions & 0 deletions src/server/middleware/graphql.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const { ApolloServer } = require('apollo-server-koa');
const responseCachePlugin = require('apollo-server-plugin-response-cache');
const { typeDefs, resolvers } = require('../graphql');
const config = require('../config');

Expand All @@ -10,6 +11,7 @@ module.exports = new ApolloServer({
'schema.polling.enable': false,
},
},
plugins: [responseCachePlugin()],
cacheControl: {
defaultMaxAge: config.graphql.defaultMaxAge,
},
Expand Down

0 comments on commit 44939c8

Please sign in to comment.