spcache

Simple Cache library

npm install spcache
1 downloads in the last week
1 downloads in the last month

cached-ntwitter

Simple Cache library, using redis as memstore.

Usage

var SPCache = require('spcache');
var cache = new SPCache({
    // configuration
    ttl: (3600 * 24) // cache for 24 hours
    pfx: 'spcache' // redis key prefix
});

// Adding objects (objects will be converted to json)
cache.add({ name: "object name", text: "Lorem Ipsum" }, "object ID");

// Fetch all object
cache.fetch(function(err, results) {
    console.log(results);
});

// Fetch all objects between an 5 hours ago, and ten minutes ago.
var now  = new Date().getTime();
var from = now - ((5 * 3600) * 1000);
var to      = now - 600000;

cache.fetch(from, to, function(err, results) {
    console.log(results);
});
npm loves you