The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

lru cache

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

Usage:

```javascript var LRU = require("lru-cache") , options = { max: 500 , length: function (n) { return n * 2 } , dispose: function (key, n) { n.close() } , maxAge: 1000 * 60 * 60 } , cache = LRU(options) , otherCache = LRU(50) // sets just the max size

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.

Options

API