0.0.1 • Published 10 years ago

memorycache v0.0.1

Weekly downloads
4
License
-
Repository
-
Last release
10 years ago

memorycache

simple in memory cache for Node.js with expiring keys

//create a cache object with size 100
var cache = require('memorycache').create(100);

// set foo:bar
cache.set('foo', 'bar');

//return bar
cache.get('foo');

//delete foo
cache.delete('foo');

//expire a key after 1 second...
cache.set('see you', 'later', 1000);

//cancel expire
cache.expire('see you', 0);

//get keys
cache.keys();

//get expiring keys
cache.expireKeys();

//get date expires... null if none
cache.expiresAt('some key');

//get ttl -- 0 if none
cache.ttl('some key');

Logging uses bunyun.