A simple set/get wrapper for using json with memjs.
Add it to your project:
$ npm install --save https://github.com/yurivictor/memjs-wrapper.git
Get and set some stuff:
// Require the library
var Cache = require( 'memjs-wrapper' );
// Initiate the client
var cache = new Cache();
// Set a json object
cache.set( 'hello', { who_am_i: "you" }, show_results );
// Get a json object
cache.get( 'hello', show_results );
// Show results
function show_results ( val ) {
console.log( val );
}
To view the example, clone the repo and install the dependencies:
$ git clone git://github.com/yurivictor/memjs-wrapper.git
$ cd memjs-wrapper
$ npm install
Then run the example:
$ node example.js
Add to existing heroku dyno:
heroku addons:create memcachier:dev
Make sure you have memcached installed.
MacOS:
brew install memcached
Then run memcache:
memcached -v
The original author is @yurivictor.