README
apollo-server-cache-aerospike-kv
This package exports an implementation of KeyValueCache
that allows using Aerospike as a backing store for resource caching in Data Sources.
Installation
aerospike npm package need to be installed as peerDependencies
.
$ npm install aerospike apollo-server-cache-aerospike-kv
Usage
import { ApolloServer } from 'apollo-server';
import { AerospikeCache } from 'apollo-server-cache-aerospike-kv';
import responseCachePlugin from 'apollo-server-plugin-response-cache';
const server = new ApolloServer({
typeDefs,
resolvers,
cache: new AerospikeCache({
hosts: '127.0.0.1:3000',
}, {
namespace: 'test',
set: 'cache',
}),
cacheControl: {
defaultMaxAge: 5,
},
plugins: [responseCachePlugin()],
dataSources: () => ({
moviesAPI: new MoviesAPI(),
}),
});
For documentation of the options you can pass to the underlying Aerospike client, look here.