@globality/nodule-memcached v0.2.0
nodule-memcached
Nodule memcached client bindings
Nodule-memcached is a library wrapper around the Memcached client, porting code from memcached-promisify
and using it in the nodule-graphql context, binding the client to the graph,
Usage
This library assumes that in the config object of your nodule-config container
you have a few config keys:
config.cache.enabled- true/falseconfig.cache.memcached.hosts- a comma-delimited array of memcached hostsconfig.cache.memcached- an object configuring the Memcached client itself (see API here)
inside a nodule-graphql project's app.js:
import { bindServices } from '@globality/nodule-graphql';
import initializeCacheClient from '@globality/nodule-memcached';
// inside createApp()
initializeCacheClient();initializeCacheClient binds the cache client on the graph, the client is accessible by:
const { client } = getContainer();The memcached client itself is also available for import:
import { Cache } from from '@globality/nodule-memcached';
const client = new Cache({hosts: 'host1,host2', ...});Local Development
Local development of nodule-memcached with other repos has a few common pitfalls related to the
usage of peer dependencies:
nodule-configis a peer-dependency because various libraries act as plugins to it and it needs a single import ofbottlejsto share plugin state
To work with nodule-memcached locally:
Run
yarn buildwithinnodule-memcachedto transpile the source.Change directories to your local repo that you want to test against
nodule-memcached.Run
yarn add /path/to/nodule-memcachedto copy the transpiled source into your local repo. Do NOT useyarn linkAfter running
yarn add, remove (or move-of-the-way) thenodule_modulesfrom withinnodule_modules/@globality/nodule-memcached/
4 years ago
4 years ago
4 years ago
4 years ago
6 years ago
6 years ago
7 years ago
7 years ago
7 years ago