cb-cache

0.1.1 • Public • Published

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 key
  • callback: 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 key
  • value: Mixed Either a buffer, JSON, number or string that you want to store.
  • lifetime: Number, how long the data needs to be stored measured in seconds
  • 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 key
  • callback: Function the callback
memcached.del('foo', function (err) { /* stuff */ });

Readme

Keywords

none

Package Sidebar

Install

npm i cb-cache

Weekly Downloads

2

Version

0.1.1

License

MIT

Last publish

Collaborators

  • ericmoritz