node/deps/npm/node_modules/lru-cache
isaacs 911b0fddd3 Upgrade npm to 1.1.26 2012-06-15 10:00:30 -07:00
..
lib Upgrade npm to 1.1.26 2012-06-15 10:00:30 -07:00
.npmignore npm 1.1.0-beta-2 2011-12-14 14:17:16 -08:00
AUTHORS Upgrade npm to 1.1.26 2012-06-15 10:00:30 -07:00
LICENSE npm 1.1.0-beta-2 2011-12-14 14:17:16 -08:00
README.md Upgrade npm to 1.1.26 2012-06-15 10:00:30 -07:00
package.json Upgrade npm to 1.1.26 2012-06-15 10:00:30 -07:00

README.md

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.