This package is a fork of Apollo Server Cache Redis but written in javascript and with the goal of having the Apollo Server always up even if Redis server is down.
This package exports an implementation of KeyValueCache
that allows using Redis as a backing store for resource caching in Data Sources.
It currently supports a single instance of Redis.
import { RedisCache } from 'apollo-redis-cache';
const server = new ApolloServer({
typeDefs,
resolvers,
cache: new RedisCache({
host: 'redis-server',
// Options are passed through to the Redis client
}),
dataSources: () => ({
moviesAPI: new MoviesAPI(),
}),
});
For documentation of the options you can pass to the underlying redis client, look here.