Welcome to mirror list, hosted at ThFree Co, Russian Federation.

README.md « lru-cache « node_modules - github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: f342b519b476a061a4bb9098216aaf54944dd8e2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# 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.