NodeJS memcached client with the most efficient ASCII protocol parser.
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.
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
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.
- 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, andJSONvalues - APIs Support callback or Promise
- Support fire and forget requests
- Support multiple connections
- Support TLS connections
This repo uses lerna to manage multiple packages.
- memcache-client -
The primary package which is the memcached client.
- memcache-parser -
A very efficient memcached ASCII protocol parser.
- memcached-njs -
A working memcached server implemented in NodeJS for tests.
- Clone this repo
- run
nvm use - run
npm ci - run
npm run bootstrap - optional: just to make sure everything is fine run
npm run buildand check if there's no error using that command - Testing: run
npm test
- Recommended publish flow is to publish the modules individually using
npm publish, can be improved to use lerna in the future
Apache-2.0 © Joel Chen