/ archiveofbelonging.org / back / node_modules / lru-cache /

[ICO]NameLast modifiedSizeDescription
[PARENTDIR]Parent Directory  -  
[DIR]node_modules/2 years ago -  
[   ]LICENSE39 years ago765 7375cab EXHIBTION: fix overflow ellipsis cutoff [كارل مبارك]
[TXT]README.md39 years ago5.8Kf12eb36 documentaiton updates [كارل مبارك]
[   ]index.js39 years ago8.0K 
[   ]package.json2 years ago1.7K7375cab EXHIBTION: fix overflow ellipsis cutoff [كارل مبارك]
README.md

lru cache

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

Build Status Coverage Status

Installation:

npm install lru-cache --save

Usage:

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

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

// non-string keys ARE fully supported
// but note that it must be THE SAME object, not
// just a JSON-equivalent object.
var someObject = { a: 1 }
cache.set(someObject, 'a value')
// Object keys are not toString()-ed
cache.set('[object Object]', 'a different value')
assert.equal(cache.get(someObject), 'a value')
// A similar object with same keys/values won't work,
// because it's a different object identity
assert.equal(cache.get({ a: 1 }), undefined)

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

Apache/2.4.38 (Debian) Server at www.karls.computer Port 80