Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

memorycache

a simple memory based cache with expiring keys for node.js

cache, memorycache, hash, l1 cache

readme

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.