Skip to content

Commit

Permalink
readme update
Browse files Browse the repository at this point in the history
  • Loading branch information
isaacs committed Apr 10, 2012
1 parent 83c1a5b commit 2899119
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,22 @@ A cache object that deletes the least-recently-used items.
Usage:

var LRU = require("lru-cache")
, cache = LRU(10) // max 10 items. default = Infinity
, 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.

0 comments on commit 2899119

Please sign in to comment.