0.0.1 • Published 7 years ago

sliding-cache v0.0.1

Weekly downloads
3
License
MIT
Repository
github
Last release
7 years ago

sliding-cache

A node in-memory cache helper that serves an object from cache as long as it requested within the specified time frame.

Usage

var SlidingCache = require('sliding-cache');
var slidingCache = new SlidingCache();

var liveDataSource = function(callback) {
	httprequestmodule.get(url, data, function(err, response) {
		if(!err) {
			callback(response.body);
		}
	});
}

slidingCache.Run('SOME_KEY_HERE', liveDataSource, function(data) {
    res.json(data);
}, 7000);