/ student-intifada / node_modules / lru-cache /

[ICO]NameLast modifiedSizeDescription
[PARENTDIR]Parent Directory  -  
[   ]LICENSEa year ago765  
[TXT]README.mda year ago5.8K595aea1 more query options + view options [كارل مبارك]
[   ]index.jsa year ago8.0K 
[   ]package.jsona year ago776 afd0ccc remove unused [كارل مبارك]
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