{"name":"array-lru","version":"1.1.1","description":"A really fast LRU cache for array items (numeric keys)","main":"index.js","dependencies":{},"devDependencies":{"hashlru":"^1.0.6","nanobench":"^1.0.3","standard":"^8.6.0","tape":"^4.6.3"},"scripts":{"test":"standard && tape test.js","bench":"node bench.js"},"repository":{"type":"git","url":"https://github.com/mafintosh/array-lru.git"},"author":{"name":"Mathias Buus","url":"@mafintosh"},"license":"MIT","bugs":{"url":"https://github.com/mafintosh/array-lru/issues"},"homepage":"https://github.com/mafintosh/array-lru","gitHead":"21bcf014117293e8ad10cd9d3d71e7c1b67675ed","_id":"array-lru@1.1.1","_shasum":"0c7e1b4e022ae166ff1e8448c595f3181fcd3337","_from":".","_npmVersion":"2.15.11","_nodeVersion":"4.7.0","_npmUser":{"name":"mafintosh","email":"mathiasbuus@gmail.com"},"dist":{"shasum":"0c7e1b4e022ae166ff1e8448c595f3181fcd3337","tarball":"http://registry-npm.ywwl.com/array-lru/download/array-lru-1.1.1.tgz","integrity":"sha512-DgyrnKyaWLX2YfWtjGcLXJU2/MAf2iYL8kgszqkfgnZvTW3iXfSohkP/ExAVgHRVWDwzdblCF/7Mpl51jUcyxQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIB10M8s+vhdlUzu+t63aiQe7/0zmExOOoOBt3VCRWBNZAiEAsZhSDKWTYsMCuZZrV3b6phZVQzSSs8JSDK+qfrW2cK4="}],"size":4551,"noattachment":false,"key":"/array-lru/-/array-lru-1.1.1.tgz"},"maintainers":[{"name":"mafintosh","email":"mathiasbuus@gmail.com"}],"_npmOperationalInternal":{"host":"packages-18-east.internal.npmjs.com","tmp":"tmp/array-lru-1.1.1.tgz_1485204196064_0.9761799699626863"},"directories":{},"readme":"# arraylru\n\nA really fast LRU cache for array items (numeric keys)\n\n```\nnpm install array-lru\n```\n\n[![build status](https://travis-ci.org/mafintosh/array-lru.svg?branch=master)](http://travis-ci.org/mafintosh/array-lru)\n\nCredit to [@dominictarr](https://github.com/dominictarr) for telling me about this neat algorithm for LRUs.\n\n## Usage\n\n``` js\nvar alru = require('array-lru')\nvar lru = alru(512) // create a lru that can contain 512 values\n\nlru.set(42, {hello: 'world'})\nconsole.log(lru.get(42)) // {hello: 'world'}\n```\n\nIt works similar to a normal hash table except when a bucket is full it will\nevict the oldest one from the bucket to make room for the new value.\n\n## API\n\n#### `var lru = alru(size, [options])`\n\nCreate a new LRU instance. Options include:\n\n``` js\n{\n  collisions: 4, // how many hash collisions before evicting (default 4)\n  evict: fn, // call this function with (index, value) when someone is evicted\n  indexedValues: false // set to true if your values has a .index property\n}\n```\n\nSize should be a multiple of `collections`. If not, it will be coerced into one.\n\n### `var value = lru.get(index)`\n\nGet a value from the cache. If the index is not found, `null` is returned.\n\n### `lru.set(index, value)`\n\nInsert a new value in the cache. If there is no room in the hash bucket that\n`index` maps to, the oldest value in the bucket will be evicted.\n\n### Performance\n\nOn my MacBook 12\" I can set/get around 7.500.000 values per second, YMMV.\nRun the benchmark using `npm run bench` to test it for yourself.\n\n## License\n\nMIT\n","publish_time":1485204196694,"_cnpm_publish_time":1485204196694,"dist-tags":{"latest":"1.1.1"}}