0.2.1 • Published 4 years ago

apollo-server-cache-aerospike-kv v0.2.1

Weekly downloads
2
License
MIT
Repository
github
Last release
4 years ago

apollo-server-cache-aerospike-kv Build Status

NPM

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.