2018-06-20 09:44:06 +02:00
## RedisCache
2018-06-19 14:34:28 -07:00
2018-07-18 18:30:09 -07:00
[](https://badge.fury.io/js/apollo-server-cache-redis)
2018-07-04 01:32:02 +08:00
[](https://circleci.com/gh/apollographql/apollo-server)
2018-06-19 14:34:28 -07:00
This package exports an implementation of `KeyValueCache` that allows using Redis as a backing store for resource caching in [Data Sources ](https://www.apollographql.com/docs/apollo-server/v2/features/data-sources.html ).
## Usage
```js
2018-07-18 18:30:09 -07:00
const { RedisCache } = require('apollo-server-cache-redis');
2018-06-19 14:34:28 -07:00
const server = new ApolloServer({
typeDefs,
resolvers,
2018-06-20 09:44:06 +02:00
cache: new RedisCache({
2018-06-19 14:34:28 -07:00
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 ](https://github.com/NodeRedis/node_redis ).