-
Notifications
You must be signed in to change notification settings - Fork 537
Is caching not supported? #561
Comments
@BruceL33t got the same issue - would prefer to use express-graphql instead of Apollo but need the caching goodness! |
Hey, guys, it took me around 10Sec but I also google it and got here , I'm Switching some part of an existing Project to GraphQl , hope its helpful const apicache = require('apicache') // you need to install this one THNEN: app.use('/server/graphql',cacheSuccesses, graphqlHTTP({ this is my prefer chaching , just to chache 200Code, is the best Idea I think, but you can follow Docs of Package and if you want you can chache whole response code |
I was looking into this, but since you can add cache directives and you receive them inside the https://github.com/apollographql/apollo-server/blob/master/packages/apollo-cache-control/src/index.ts this is how apollo server does it. This is an example of what you should receive:
I could create a middleware that checks the resolver result and if it has cache hints, if it does set the correct cache-control headers |
I've found no documentation about how to do caching in express-graphql, and I really would like to not have to switch to apollo-server, to be able to set a simple TTL per resolver. Is caching really not something you think should be built into express-graphql (a generic solution that can be overridden) or at least supported so you can easily add your own cache implementation? If caching is indeed possible, could anyone point point me in the right direction as to how to implement it.
The text was updated successfully, but these errors were encountered: