Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
In memory cache for Node. You can use multi cache space like namespace.
JavaScript
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
libs
test
README.md
index.js
package.json

README.md

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.

Something went wrong with that request. Please try again.