0.0.1 • Published 12 years ago

spcache v0.0.1

Weekly downloads
9
License
-
Repository
github
Last release
12 years ago

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

12 years ago