spcache

0.0.1 • Public • Published

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);
});

Readme

Keywords

none

Package Sidebar

Install

npm i spcache

Weekly Downloads

1

Version

0.0.1

License

none

Last publish

Collaborators

  • fabdrol