You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

58 lines
2.9 KiB

{
"name": "lru-cache",
"description": "A cache object that deletes the least-recently-used items.",
"version": "2.0.2",
"author": {
"name": "Isaac Z. Schlueter",
"email": "i@izs.me"
},
"scripts": {
"test": "tap test"
},
"main": "lib/lru-cache.js",
"repository": {
"type": "git",
"url": "git://github.com/isaacs/node-lru-cache.git"
},
"devDependencies": {
"tap": ""
},
"license": {
"type": "MIT",
"url": "http://github.com/isaacs/node-lru-cache/raw/master/LICENSE"
},
"contributors": [
{
"name": "Isaac Z. Schlueter",
"email": "i@izs.me"
},
{
"name": "Carlos Brito Lage",
"email": "carlos@carloslage.net"
},
{
"name": "Marko Mikulicic",
"email": "marko.mikulicic@isti.cnr.it"
},
{
"name": "Trent Mick",
"email": "trentm@gmail.com"
},
{
"name": "Kevin O'Hara",
"email": "kevinohara80@gmail.com"
},
{
"name": "Marco Rogers",
"email": "marco.rogers@gmail.com"
},
{
"name": "Jesse Dailey",
"email": "jesse.dailey@gmail.com"
}
],
"readme": "# lru cache\n\nA cache object that deletes the least-recently-used items.\n\n## Usage:\n\n```javascript\nvar LRU = require(\"lru-cache\")\n , options = { max: 500\n , length: function (n) { return n * 2 }\n , dispose: function (key, n) { n.close() }\n , maxAge: 1000 * 60 * 60 }\n , cache = LRU(options)\n , otherCache = LRU(50) // sets just the max size\n\ncache.set(\"key\", \"value\")\ncache.get(\"key\") // \"value\"\n\ncache.reset() // empty the cache\n```\n\nIf you put more stuff in it, then items will fall out.\n\nIf you try to put an oversized thing in it, then it'll fall out right\naway.\n\n## Options\n\n* `max` The maximum number of items. Not setting this is kind of\n silly, since that's the whole purpose of this lib, but it defaults\n to `Infinity`.\n* `maxAge` Maximum age in ms. Items are not pro-actively pruned out\n as they age, but if you try to get an item that is too old, it'll\n drop it and return undefined instead of giving it to you.\n* `length` Function that is used to calculate the length of stored\n items. If you're storing strings or buffers, then you probably want\n to do something like `function(n){return n.length}`. The default is\n `function(n){return 1}`, which is fine if you want to store `n`\n like-sized things.\n* `dispose` Function that is called on items when they are dropped\n from the cache. This can be handy if you want to close file\n descriptors or do other cleanup tasks when items are no longer\n accessible. Called with `key, value`. It's called *before*\n actually removing the item from the internal cache, so if you want\n to immediately put it back in, you'll have to do that in a\n `nextTick` or `setTimeout` callback or it won't do anything.\n",
"_id": "lru-cache@2.0.2",
"_from": "lru-cache@~2.0.0"
13 years ago
}