Skip to content

Couchbase implementation of Apollo Server KeyValue cache store

License

Notifications You must be signed in to change notification settings

pecodez/apollo-server-cache-couchbase

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

apollo-server-cache-couchbase

A Couchbase implementation of Apollo Server KeyValue cache store.

While Memcached and Redis make a preferred solution to a query cache for Apollo Server, if your backend is already using Couchbase, you should make use of a memcached Couchbase bucket rather than throwing more tech on your stack. This is why I wrote apollo-server-cache-couchbase.

ApolloServer

const { CouchbaseCache } = require('apollo-server-cache-couchbase');
const { ApolloServer } = require('apollo-server');

const server = new ApolloServer({
    ...
    persistedQueries: {
        cache: new CouchbaseCache(
            {
                host: 'couchbase://localhost',
                bucket: 'gqlcache',
                auth: {
                    username: 'username',
                    password: 'password'
                }
            }
        )
    }
});

ApolloServer with Express

const express = require('express');
const { CouchbaseCache } = require('apollo-server-cache-couchbase');
const { ApolloServer } = require('apollo-server-express');

const app = express();

const server = new ApolloServer({
    ...
    persistedQueries: {
        cache: new CouchbaseCache(
            {
                host: 'couchbase://localhost',
                bucket: 'gqlcache',
                auth: {
                    username: 'username',
                    password: 'password'
                }
            }
        )
    }
});

server.applyMiddleware({ app });

About

Couchbase implementation of Apollo Server KeyValue cache store

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •