Skip to content

Node.js memcached client with the most efficient ASCII protocol parser

Notifications You must be signed in to change notification settings

makenotion/memcache

Repository files navigation

memcache

NodeJS memcached client with the most efficient ASCII protocol parser.

Notion specifics

Forked from https://github.com/electrode-io/memcache for Notion by Scott Sandler

Our fork is primarily to add support for the meta protocol and a hashring implementation, as well as to enable migration from MemJS.

Private publishing:

The fact that this repo uses lerna makes it harder to install the packages. We need both memcache-client and memcache-parser in our repo. Here's how I did this:

npm run build
sudo npm i -g gitpkg
cd packages/memcache-parser
gitpkg publish
cd ../memcache-client
gitpkg publish

This uses gitpkg which generates tags in this repo for each of the packages with just the built artifacts.

Then, in notion-next to install I did:

npm i --save git://github.com/makenotion/memcache.git#memcache-parser-v1.0.1-gitpkg git://github.com/makenotion/memcache.git#memcache-client-v1.0.5-gitpkg

Local development

You can use npm link to test changes to the packages in this repo.

cd packages/memcache-client
npm link

cd <path to your notion-next checkout>
npm link memcache-client

You'll have to explicitly npm run build in the memcache working copy each time you make changes, since npm link symlinks to the dist/ directory containing build artifacts.

Features

  • Very efficient memcached ASCII protocol parser by using only NodeJS Buffer APIs.
  • Optional compression for the data before sending to memcached
  • Auto reconnects when there's network error or timeout
  • Support sending arbitrary commands. Read up on the protocol doc here.
  • Support storing string, numeric, and JSON values
  • APIs Support callback or Promise
  • Support fire and forget requests
  • Support multiple connections
  • Support TLS connections

Packages

This repo uses lerna to manage multiple packages.

Development environment installation

  1. Clone this repo
  2. run nvm use
  3. run npm ci
  4. run npm run bootstrap
  5. optional: just to make sure everything is fine run npm run build and check if there's no error using that command
  6. Testing: run npm test

Publishing notes

  • Recommended publish flow is to publish the modules individually using npm publish, can be improved to use lerna in the future

Other Implementations

License

Apache-2.0 © Joel Chen

About

Node.js memcached client with the most efficient ASCII protocol parser

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •