You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Mar 8, 2023. It is now read-only.
Apollo Graphql Server has a caching mechanism that can be implemented with a cache server like Redis https://www.apollographql.com/docs/apollo-server/performance/caching/ , would this be a possible solution for this issue, from my tests, it could be implemented with minimal changes across all queries.
The config with redis would look something like this, by modifying the ApolloServer setup in the src/index.ts file:
import responseCachePlugin from 'apollo-server-plugin-response-cache';
const { RedisCache } = require('apollo-server-cache-redis');
if (config.get('server.useOutputCache')) {
useQueryCache = {
cache: new RedisCache(`//${config.get('redis.host')}:${config.get('redis.port')}`),
cacheControl: {
defaultMaxAge: config.get('server.outputCacheDefaultTtl')
},
plugins: [responseCachePlugin()]
}
}
if (aggregatedGraphqlConfig.hasGraphqlSupport) {
const server = new ApolloServer({
typeDefs: mergeTypes(aggregatedGraphqlConfig.schema, { all: true }),
resolvers: aggregatedGraphqlConfig.resolvers,
rootValue: global,
playground: true,
...useQueryCache,
context: integrationContext => integrationContext
});
server.applyMiddleware({ app, path: '/graphql' });
} else {
console.info(
'No GraphQL Support enabled. Please provide at least one module supporting graphQL schema.'
);
}
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
What is the motivation for adding/enhancing this feature?
At the moment, the SSR caching is supposed to work with the REST catalog endpoint only
The same output cache - including tagging - should be added on resolvers level
What are the acceptance criteria
The text was updated successfully, but these errors were encountered: