cb-cache
v0.1.1
Published
A minimal memcached compatible interface to couchbase
Downloads
10
Readme
cb-cache
A simple memcached like interface to couchbase
Usage
var couchbase = require('couchbase');
var CBCache = require('cb-cache');
var cluster = new couchbase.Cluster("couchbase://127.0.0.1");
var bucket = cluster.openBucket("cache");
var cache = new CBCache(bucket);
cache.get('foo', function (err, data) {
console.log(data);
});
API
CBCache.get Get the value for the given key.
key
: String, the keycallback
: Function, the callback.
cache.get('foo', function (err, data) {
console.log(data);
});
cache.set Stores a new value in Cache.
key
: String the name of the keyvalue
: Mixed Either a buffer, JSON, number or string that you want to store.lifetime
: Number, how long the data needs to be stored measured inseconds
callback
: Function the callback
cache.set('foo', 'bar', 10, function (err) { /* stuff */ });
memcached.del Remove the key from memcached.
key
: String the name of the keycallback
: Function the callback
memcached.del('foo', function (err) { /* stuff */ });