Closed websolutions-hamburg closed 5 years ago
I could be wrong but I dont think it works, I think because apollo-server-express doesn't do caching, hopefully will be fixed with v3 https://github.com/apollographql/apollo-server/issues/2360
Not fully sure that this is the case though, I haven't found a definite answer :D
There's also this, I will try it out when I get a chance https://github.com/19majkel94/type-graphql/blob/v0.17.4/examples/apollo-engine/index.ts
Did you make any progress on this?
Havent had a chance and it might be a while, check this out https://github.com/19majkel94/type-graphql/blob/v0.17.4/examples/apollo-engine/cache-control.ts
@arjunyel @esistgut any news ? ;)
I tried to put my own cache class when I configure my graphQL module and indeed, it is not used:
GraphQLModule.forRoot({
autoSchemaFile: join(process.cwd(), 'apps/api/src/graphql/schema.graphql'),
tracing: true,
debug: true,
cacheControl: true,
cache: new SchemaCache()
}),
I tried to add the Decorator CacheControl
like the example https://github.com/19majkel94/type-graphql/blob/v0.17.4/examples/apollo-engine/cache-control.ts
but nothing happen.
I already put in place the Dataloader to cache/batch my api REST/Database calls when resolving but I would like to cache the model already resolved to re-use it in services...any ideas ?
Thx ;)
Both cache
and cacheControl
options are being passed down directly to the ApolloServer
constructor https://github.com/nestjs/graphql/blob/master/lib/graphql.module.ts#L179. I don't think that this issue is related to @nestjs/graphl
to be honest.
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
I'm submitting a...
Current behavior
Is it possible to use the apollo cache control with Nest?
https://www.apollographql.com/docs/apollo-server/features/caching
This is an example code for schema first and the apollo cache control:
Is it possible to use this also with Nest and code first instead of schema first?
I configured my graphql module with this configuration, to use the default max age:
This creates the correct response header with
cache-control: max-age=60
. But it doesn't work. Every request in the next 60 seconds is not cached. All the time my resolvers will be trigered and generate a new response.Environment