{"_id":"lru-native","_rev":"26-1b99d5f88819cb4f7c074e37b4a5446d","name":"lru-native","description":"a native LRU cache implementation","dist-tags":{"latest":"0.4.0"},"versions":{"0.1.0":{"name":"lru-native","version":"0.1.0","description":"a native LRU cache implementation","devDependencies":{"chai":"latest","mocha":"latest"},"scripts":{"valgrind":"valgrind --leak-check=full --show-possibly-lost=no node --expose-gc --trace-gc node_modules/mocha/bin/_mocha -R spec --compilers coffee:coffee-script","install":"node-gyp rebuild"},"gypfile":true,"_id":"lru-native@0.1.0","dist":{"shasum":"36ee1ec7db2e79fa45a71cc41813d3becbbe4b08","tarball":"https://registry.npmjs.org/lru-native/-/lru-native-0.1.0.tgz","integrity":"sha512-L4Zt88fKemLdIyxNgq1YJC+CD+yU3I0hBst0/geQ08+Yv6+r3smSzDKV5rzl0TUpFuVQfzmB0jljMEN+5t4MgA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDJ+spyc+pG2i/DO9RX8Ivx72ZlyFVRoC/oGlVEVDtqpwIhAN/hW5V4OnCZGppAKKpBsiVflKpsRGkrr+pm3rZXlnzm"}]},"_npmVersion":"1.1.65","_npmUser":{"name":"nkohari","email":"nkohari@gmail.com"},"maintainers":[{"name":"nkohari","email":"nkohari@gmail.com"}],"directories":{}},"0.2.0":{"name":"lru-native","version":"0.2.0","description":"a native LRU cache implementation","devDependencies":{"chai":"latest","mocha":"latest"},"scripts":{"valgrind":"valgrind --leak-check=full --show-possibly-lost=no node --expose-gc --trace-gc node_modules/mocha/bin/_mocha -R spec --compilers coffee:coffee-script","install":"node-gyp rebuild"},"gypfile":true,"_id":"lru-native@0.2.0","dist":{"shasum":"f1f54272b9f9988b76805640443c6d739a3784b8","tarball":"https://registry.npmjs.org/lru-native/-/lru-native-0.2.0.tgz","integrity":"sha512-0nA1mAcAhKnSMYLWO951O8pSYmCA+qsh/sKceB87GqF9LboGqBQfAOIzfZ8QKAnMKFwSqxRJbT8/6svkeQ1ecA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIETyRcUBzKNpCGwCHMblzR0dIj2HSW8AIIu0ZWkfR7WpAiB0OglGod8PVtwwznxMg/W3CZ3tPxMf+ikG+LjbjzHMIQ=="}]},"_npmVersion":"1.1.65","_npmUser":{"name":"nkohari","email":"nkohari@gmail.com"},"maintainers":[{"name":"nkohari","email":"nkohari@gmail.com"}],"directories":{}},"0.3.0":{"name":"lru-native","version":"0.3.0","description":"a native LRU cache implementation","devDependencies":{"chai":"latest","mocha":"latest"},"scripts":{"valgrind":"valgrind --leak-check=full --show-possibly-lost=no node --expose-gc --trace-gc node_modules/mocha/bin/_mocha -R spec --compilers coffee:coffee-script","install":"node-gyp rebuild"},"gypfile":true,"_id":"lru-native@0.3.0","dist":{"shasum":"f31b3c49acc19f0b20ac9c5b8e43fa4acfec801a","tarball":"https://registry.npmjs.org/lru-native/-/lru-native-0.3.0.tgz","integrity":"sha512-xiU8k1WuwNGeTB1ybokLD1OYbQqciXpoYP416h5nur6a3NCmv+QoJv9KIBuPH6WhZfp4/0M0YOsE1fCmcZUeUA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIGHurcZjQoo2EQsaQn1Ml78zr789V5sgZcJTnI3Mo4soAiEAjHWpQ1+0h5xT+X01KDWe8PxUKQTB3EjeNF22cJfjtEM="}]},"_npmVersion":"1.1.65","_npmUser":{"name":"nkohari","email":"nkohari@gmail.com"},"maintainers":[{"name":"nkohari","email":"nkohari@gmail.com"}]},"0.3.1":{"name":"lru-native","version":"0.3.1","description":"a native LRU cache implementation","devDependencies":{"chai":"latest","coffee-script":"1.7.1","mocha":"latest"},"scripts":{"valgrind":"valgrind --leak-check=full --show-possibly-lost=no node --expose-gc --trace-gc node_modules/mocha/bin/_mocha -R spec --compilers coffee:coffee-script","install":"node-gyp rebuild"},"gypfile":true,"gitHead":"979dd70eb875c4b6cbd9a483371ec3b6072032e6","_id":"lru-native@0.3.1","_shasum":"112287987364b5585fbbf44e706d0cd14bbc4b3f","_from":".","_npmVersion":"3.3.6","_nodeVersion":"5.0.0","_npmUser":{"name":"micha","email":"micha.niskin@gmail.com"},"dist":{"shasum":"112287987364b5585fbbf44e706d0cd14bbc4b3f","tarball":"https://registry.npmjs.org/lru-native/-/lru-native-0.3.1.tgz","integrity":"sha512-rMp+1FpxAIWRpZoUhbJ4FKslGrSrlX97e0SUENsVSgxaEJ/ov+RTbE4Byyaa6VdxspcurGbHLXScZ669BZo/pg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQD7byVoP3oR3+Hlhj7s9INjoOQ0R0FBz2H/Q6fYPG/MeAIgLhlsZdenaRxrbF9VI3A9COOVO4mpoYS/l+DErOMSpTw="}]},"maintainers":[{"name":"averyj","email":"javery@adzerk.com"},{"name":"micha","email":"micha.niskin@gmail.com"},{"name":"nkohari","email":"nkohari@gmail.com"},{"name":"skrblr","email":"vchwalowski@adzerk.com"}]},"0.4.0":{"name":"lru-native","version":"0.4.0","description":"a native LRU cache implementation","devDependencies":{"chai":"latest","coffee-script":"1.7.1","mocha":"latest","nan":"^2.2.0"},"scripts":{"valgrind":"valgrind --leak-check=full --show-possibly-lost=no node --expose-gc --trace-gc node_modules/mocha/bin/_mocha -R spec --compilers coffee:coffee-script","install":"node-gyp rebuild"},"gypfile":true,"gitHead":"225100192d4d2813b78978731bccbb36a7e69ce7","_id":"lru-native@0.4.0","_shasum":"bc13c32dfbd1719c02f1a0392a54e7e5c6114654","_from":".","_npmVersion":"3.3.6","_nodeVersion":"5.0.0","_npmUser":{"name":"micha","email":"micha.niskin@gmail.com"},"dist":{"shasum":"bc13c32dfbd1719c02f1a0392a54e7e5c6114654","tarball":"https://registry.npmjs.org/lru-native/-/lru-native-0.4.0.tgz","integrity":"sha512-iAbjyk8U99qUy+zpZpht8/xmdbeP50wgfqfZtEzy2m5d007iLG6fxlffLUgFCNHp9qRHUt4zRNWUyrke6u7PYw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIGxo7NxjAdE/5XK3y4uVqKCCWK8EEbaRoib9WGYRL5PJAiEA2OQxmUyCs20TBRKsOc14wWOOiREk9Igsx7TI5k3bWfI="}]},"maintainers":[{"name":"averyj","email":"javery@adzerk.com"},{"name":"micha","email":"micha.niskin@gmail.com"},{"name":"nkohari","email":"nkohari@gmail.com"},{"name":"skrblr","email":"vchwalowski@adzerk.com"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/lru-native-0.4.0.tgz_1463932449529_0.8754623206332326"}}},"readme":"node-lru-native\n===============\n\nThis is an implementation of a simple in-memory cache for node.js, supporting LRU (least-recently-used) eviction\nand TTL expirations.\n\nIt was developed as an alternative to the (excellent) [node-lru-cache](https://github.com/isaacs/node-lru-cache)\nlibrary for use with hashes with a very large number of items. V8 normally does a good job of optimizing the\nin-memory representation of objects, but it isn't optimized for an object that holds a huge amount of data.\nWhen you add a very large number of properties (particularly with non-integer keys) to an object, performance\nbegins to suffer.\n\nRather than rely on V8 to figure out what we're trying to do, `node-lru-native` is a light wrapper around\n`std::unordered_map` from C++11. A `std::list` is used to track accesses so we can evict the least-recently-used\nitem when necessary.\n\nBased on the [node-hashtable](https://github.com/isaacbwagner/node-hashtable) library by Issac Wagner.\n\n# Usage\n\nInstall via npm:\n\n```\n$ npm install lru-native\n```\n\nThen:\n\n```javascript\nvar LRUCache = require('lru-native');\nvar cache = new LRUCache({ maxElements: 1000 });\ncache.set('some-key', 42);\nvar value = cache.get('some-key');\n```\n\nIf you'd like to tinker, you can build the extension using [node-gyp](https://github.com/TooTallNate/node-gyp):\n\n```\n$ npm install -g node-gyp\n$ node-gyp configure\n$ node-gyp build\n```\n\n# Configuration\n\nTo configure the cache, you can pass a hash to the `LRUCache` constructor with the following options:\n\n```\nvar cache = new LRUCache({\n\n  // The maximum number of items to add to the cache before evicting the least-recently-used item.\n  // Default: 0, meaning there is no maximum.\n  maxElements: 10000,\n\n  // The maximum age (in milliseconds) of an item.\n  // The item will be removed if get() is called and the item is too old.\n  // Default: 0, meaning items will never expire.\n  maxAge: 60000,\n\n  // The initial number of items for which space should be allocated.\n  // The cache will resize dynamically if necessary.\n  size: 1000,\n\n  // The maximum load factor for buckets in the unordered_map.\n  // Typically you won't need to change this.\n  maxLoadFactor: 2.0\n\n});\n```\n\n# API\n\n## set(key, value)\n\nAdds the specified item to the cache with the specified key.\n\n## get(key)\n\nReturns the item with the specified key, or `undefined` if no item exists with that key.\n\n## remove(key)\n\nRemoves the item with the specified key if it exists.\n\n## clear()\n\nRemoves all items from the cache.\n\n## size()\n\nReturns the number of items in the cache.\n\n## stats()\n\nReturns a hash containing internal information about the cache.\n\n# Changelog\n\n- 0.4.0 -- Added support for newer versions of Node via NAN\n- 0.3.0 -- Changed memory allocation strategy, fixed issue where remove() would do a seek through the LRU list, code cleanup\n- 0.2.0 -- Fixed issue where maxAge-based removal would result in a seek through the LRU list\n- 0.1.0 -- Initial release\n","maintainers":[{"name":"averyj","email":"javery@adzerk.com"},{"name":"micha","email":"micha.niskin@gmail.com"},{"name":"nkohari","email":"nkohari@gmail.com"},{"name":"skrblr","email":"vchwalowski@adzerk.com"}],"time":{"modified":"2022-06-19T14:30:25.585Z","created":"2013-08-25T13:28:09.437Z","0.1.0":"2013-08-25T13:28:10.085Z","0.2.0":"2013-08-27T01:11:39.831Z","0.3.0":"2013-08-27T17:49:29.827Z","0.3.1":"2015-11-23T17:53:39.700Z","0.4.0":"2016-05-22T15:54:11.820Z"},"users":{"allain":true,"makay":true,"phaibin":true,"fanazhe":true},"readmeFilename":"README.md"}