node-cache-store

In memory cache for Node. You can use multi cache space.

npm install node-cache-store
8 downloads in the last month

node-cache-store

A in-memory cache system.

  • Key/Value store.
  • You can use multi cache space like namespace.

Installation

npm install node-cache-store

Usage

Simple usage

var Cache = require('node-cache-store').Cache;
var cache = new Cache() ;

// Set a cache
cache.set('key', 'value');

// get a cache
cache.set('key');

// delete a cache
cache.delete('key') ;

Multi namespace usage

var CacheStore = require('node-cache-store').CacheStore;
var cache1 = CacheStore.getInstance('space1') ;
cache1.set('foo','foo') ;

Options

var opt = {
    expire: 3600 ; // Cache expire time(sec). Defalt is no limit(-1).
    expiredLoopTerm: 3600   // interval for delete expired data(sec). Defalt is 3600 ;
} ;
var cache = new Cache(opt) ;
var cache1 = CacheStore.getInstance('space1',opt) ;

Support

Open an issue on GitHub.

npm loves you