node-gyp/node_modules/minimatch/node_modules/lru-cache
2012-06-06 14:34:07 -07:00
..
lib update minimatch to v0.2.5 2012-06-06 14:34:07 -07:00
test update minimatch to v0.2.5 2012-06-06 14:34:07 -07:00
.npmignore Commit node_modules. 2012-02-10 23:44:09 -08:00
AUTHORS update minimatch to v0.2.5 2012-06-06 14:34:07 -07:00
LICENSE Commit node_modules. 2012-02-10 23:44:09 -08:00
package.json update minimatch to v0.2.5 2012-06-06 14:34:07 -07:00
README.md update minimatch to v0.2.5 2012-06-06 14:34:07 -07:00

lru cache

A cache object that deletes the least-recently-used items.

Usage:

var LRU = require("lru-cache")
  , cache = LRU(10, // max length. default = Infinity
                // calculate how "big" each item is
                //
                // defaults to function(){return 1}, ie, just limit
                // the item count, without any knowledge as to their
                // relative size.
                function (item) { return item.length })

cache.set("key", "value")
cache.get("key") // "value"

cache.reset()    // empty the cache

If you put more stuff in it, then items will fall out.

If you try to put an oversized thing in it, then it'll fall out right away.

RTFS for more info.