0.2.0 • Published 2 years ago

@globality/nodule-memcached v0.2.0

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

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/false
  • config.cache.memcached.hosts - a comma-delimited array of memcached hosts
  • config.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-config is a peer-dependency because various libraries act as plugins to it and it needs a single import of bottlejs to share plugin state

To work with nodule-memcached locally:

  1. Run yarn build within nodule-memcached to transpile the source.

  2. Change directories to your local repo that you want to test against nodule-memcached.

  3. Run yarn add /path/to/nodule-memcached to copy the transpiled source into your local repo. Do NOT use yarn link

  4. After running yarn add, remove (or move-of-the-way) the nodule_modules from within nodule_modules/@globality/nodule-memcached/

0.2.0

2 years ago

0.1.0-dev277

2 years ago

0.1.0-dev261

3 years ago

0.1.6

3 years ago

0.1.4

4 years ago

0.1.3

5 years ago

0.1.2

6 years ago

0.1.1

6 years ago

0.1.0

6 years ago