ttl 
Simple in-memory cache for JavaScript
Installation
$ npm install ttl --save
Usage
var Cache = require('ttl');
var cache = new Cache({
ttl: 10 * 1000,
capacity: 3
});
cache.on('put', function(key, val, ttl) { });
cache.on('del', function(key, val) { });
cache.on('drop', function(key, val, ttl) { });
cache.on('hit', function(key, val) { });
cache.on('miss', function(key) { });
cache.put('foo', 'bar');
cache.put('ping', 'pong', 20 * 1000);
cache.put('yo', 'yo', 30 * 1000);
cache.put('whats', 'up');
cache.get('foo');
cache.get('yo');
cache.get('ping');
cache.get('lol');
cache.get('foo');
cache.size();
cache.del('ping')
cache.get('ping');
cache.size();
cache.clear();
cache.size();
License
MIT