{"_id":"ylru","_rev":"3370120","name":"ylru","description":"Extends LRU base on hashlru","dist-tags":{"latest":"2.0.0","release-1.x":"1.4.0"},"maintainers":[{"name":"dead-horse","email":""},{"name":"dead_horse","email":"dead_horse@qq.com"},{"name":"fengmk2","email":"fengmk2@gmail.com"}],"time":{"modified":"2024-08-19T09:22:20.000Z","created":"2016-12-29T07:21:00.334Z","2.0.0":"2024-06-22T15:26:04.185Z","1.4.0":"2024-03-28T03:44:35.502Z","1.3.2":"2022-03-16T16:24:16.160Z","1.3.1":"2022-03-16T15:59:04.541Z","1.3.0":"2022-03-16T03:11:37.486Z","1.2.1":"2018-07-11T09:33:32.621Z","1.2.0":"2017-07-18T05:43:56.573Z","1.1.0":"2017-07-04T09:03:15.619Z","1.0.0":"2016-12-29T13:15:35.491Z","0.0.1":"2016-12-29T07:21:00.334Z"},"users":{},"author":{"name":"fengmk2"},"repository":{"type":"git","url":"git://github.com/node-modules/ylru.git"},"versions":{"2.0.0":{"name":"ylru","description":"Extends LRU base on hashlru","version":"2.0.0","engines":{"node":">= 18.19.0"},"homepage":"https://github.com/node-modules/ylru","repository":{"type":"git","url":"git://github.com/node-modules/ylru.git"},"devDependencies":{"@arethetypeswrong/cli":"^0.15.3","@eggjs/tsconfig":"1","@types/node":"20","@types/mocha":"10","beautify-benchmark":"^0.2.4","benchmark":"^2.1.3","egg-bin":"6","eslint":"8","eslint-config-egg":"13","git-contributor":"2","hashlru":"^1.0.3","lru-cache":"^4.0.2","runscript":"^1.5.2","typescript":"5","tshy":"1","tshy-after":"1"},"scripts":{"contributor":"git-contributor","bench":"npm run prepublishOnly && node test/bench.cjs","lint":"eslint src test --ext .ts","test":"npm run lint -- --fix && npm run test-local","test-local":"egg-bin test","cov":"egg-bin cov","ci":"npm run lint && npm run cov && npm run prepublishOnly && attw --pack && npm run bench","prepublishOnly":"tshy && tshy-after"},"author":{"name":"fengmk2"},"license":"MIT","type":"module","tshy":{"exports":{".":"./src/index.ts","./package.json":"./package.json"}},"exports":{".":{"import":{"source":"./src/index.ts","types":"./dist/esm/index.d.ts","default":"./dist/esm/index.js"},"require":{"source":"./src/index.ts","types":"./dist/commonjs/index.d.ts","default":"./dist/commonjs/index.js"}},"./package.json":"./package.json"},"types":"./dist/commonjs/index.d.ts","main":"./dist/commonjs/index.js","_id":"ylru@2.0.0","gitHead":"dafd9b0a90e6ac912a6d8ec90fb82ada7ff1602b","bugs":{"url":"https://github.com/node-modules/ylru/issues"},"_nodeVersion":"18.20.3","_npmVersion":"10.7.0","dist":{"shasum":"b4f4412f0c772d0cb0f27322681787cc75b96090","size":6321,"noattachment":false,"key":"/ylru/-/ylru-2.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/ylru/download/ylru-2.0.0.tgz"},"_npmUser":{"name":"fengmk2","email":"fengmk2@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ylru_2.0.0_1719069964023_0.8295308258566201"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2024-06-22T15:26:04.185Z","publish_time":1719069964185,"_source_registry_name":"default","maintainers":[{"name":"dead-horse","email":""},{"name":"dead_horse","email":"dead_horse@qq.com"},{"name":"fengmk2","email":"fengmk2@gmail.com"}],"_cnpm_publish_time":1719069964185},"1.4.0":{"name":"ylru","description":"Extends LRU base on hashlru","version":"1.4.0","homepage":"https://github.com/node-modules/ylru","repository":{"type":"git","url":"git://github.com/node-modules/ylru.git"},"dependencies":{},"devDependencies":{"@types/node":"^12.0.8","beautify-benchmark":"^0.2.4","benchmark":"^2.1.3","egg-bin":"^1.10.0","egg-ci":"^1.19.0","eslint":"^4.19.1","eslint-config-egg":"^6.0.0","git-contributor":"^1.0.10","hashlru":"^1.0.3","ko-sleep":"^1.0.2","lru-cache":"^4.0.2","runscript":"^1.5.2","typescript":"^4.6.2"},"main":"index.js","scripts":{"contributor":"git-contributor","lint":"eslint test *.js","test":"npm run lint -- --fix && npm run test-local","test-local":"egg-bin test","cov":"egg-bin cov","ci":"npm run lint && npm run cov"},"author":{"name":"fengmk2"},"engines":{"node":">= 4.0.0"},"ci":{"version":"8, 10, 12, 14, 16","type":"github","os":{"github":"linux"},"npminstall":false},"license":"MIT","_id":"ylru@1.4.0","gitHead":"3a030e7e4055b1b15bcea16a86cee5fe7b56651a","types":"./index.d.ts","bugs":{"url":"https://github.com/node-modules/ylru/issues"},"_nodeVersion":"18.19.1","_npmVersion":"10.2.4","dist":{"shasum":"0cf0aa57e9c24f8a2cbde0cc1ca2c9592ac4e0f6","size":3379,"noattachment":false,"key":"/ylru/-/ylru-1.4.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/ylru/download/ylru-1.4.0.tgz"},"_npmUser":{"name":"fengmk2","email":"fengmk2@gmail.com"},"directories":{},"maintainers":[{"name":"dead-horse","email":""},{"name":"dead_horse","email":"dead_horse@qq.com"},{"name":"fengmk2","email":"fengmk2@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ylru_1.4.0_1711597475358_0.3637478527216105"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2024-03-28T03:44:35.502Z","publish_time":1711597475502,"_source_registry_name":"default","_cnpm_publish_time":1711597475502},"1.3.2":{"name":"ylru","description":"Extends LRU base on hashlru","version":"1.3.2","homepage":"https://github.com/node-modules/ylru","repository":{"type":"git","url":"git://github.com/node-modules/ylru.git"},"dependencies":{},"devDependencies":{"@types/node":"^12.0.8","beautify-benchmark":"^0.2.4","benchmark":"^2.1.3","egg-bin":"^1.10.0","egg-ci":"^1.19.0","eslint":"^4.19.1","eslint-config-egg":"^6.0.0","git-contributor":"^1.0.10","hashlru":"^1.0.3","ko-sleep":"^1.0.2","lru-cache":"^4.0.2","runscript":"^1.5.2","typescript":"^4.6.2"},"main":"index.js","scripts":{"contributor":"git-contributor","lint":"eslint test *.js","test":"npm run lint -- --fix && npm run test-local","test-local":"egg-bin test","cov":"egg-bin cov","ci":"npm run lint && npm run cov","autod":"autod"},"author":{"name":"fengmk2"},"engines":{"node":">= 4.0.0"},"ci":{"version":"4, 6, 8, 10, 12, 14, 16","type":"github","os":{"github":"linux"}},"license":"MIT","gitHead":"541d013ccd755aa4cc487d9e7734ccb2435e65e5","bugs":{"url":"https://github.com/node-modules/ylru/issues"},"_id":"ylru@1.3.2","_nodeVersion":"16.14.0","_npmVersion":"6.14.12","dist":{"shasum":"0de48017473275a4cbdfc83a1eaf67c01af8a785","size":3952,"noattachment":false,"key":"/ylru/-/ylru-1.3.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/ylru/download/ylru-1.3.2.tgz"},"_npmUser":{"name":"fengmk2","email":"fengmk2@gmail.com"},"directories":{},"maintainers":[{"name":"dead-horse","email":""},{"name":"dead_horse","email":"dead_horse@qq.com"},{"name":"fengmk2","email":"fengmk2@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ylru_1.3.2_1647447856005_0.46935164891000425"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2022-03-16T16:24:45.433Z","publish_time":1647447856160,"_cnpm_publish_time":1647447856160},"1.3.1":{"name":"ylru","description":"Extends LRU base on hashlru","version":"1.3.1","homepage":"https://github.com/node-modules/ylru","repository":{"type":"git","url":"git://github.com/node-modules/ylru.git"},"dependencies":{},"devDependencies":{"beautify-benchmark":"^0.2.4","benchmark":"^2.1.3","egg-bin":"^1.10.0","eslint":"^3.12.2","eslint-config-egg":"^3.2.0","git-contributor":"^1.0.10","hashlru":"^1.0.3","ko-sleep":"^1.0.2","lru-cache":"^4.0.2"},"main":"index.js","scripts":{"contributor":"git-contributor","lint":"eslint test *.js","test":"npm run lint -- --fix && npm run test-local","test-local":"egg-bin test","cov":"egg-bin cov","ci":"npm run lint && npm run cov","autod":"autod"},"author":{"name":"fengmk2"},"engines":{"node":">= 4.0.0"},"license":"MIT","gitHead":"ace3b39872da1ff2dda436f6fd14b7cc0bc97b2f","bugs":{"url":"https://github.com/node-modules/ylru/issues"},"_id":"ylru@1.3.1","_nodeVersion":"16.14.0","_npmVersion":"6.14.12","dist":{"shasum":"57bce62d705413b410e23534be561318f26f24e3","size":3629,"noattachment":false,"key":"/ylru/-/ylru-1.3.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/ylru/download/ylru-1.3.1.tgz"},"_npmUser":{"name":"fengmk2","email":"fengmk2@gmail.com"},"directories":{},"maintainers":[{"name":"dead-horse","email":""},{"name":"dead_horse","email":"dead_horse@qq.com"},{"name":"fengmk2","email":"fengmk2@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ylru_1.3.1_1647446344402_0.6972476400004959"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2022-03-16T15:59:08.504Z","publish_time":1647446344541,"_cnpm_publish_time":1647446344541},"1.3.0":{"name":"ylru","description":"Extends LRU base on hashlru","version":"1.3.0","homepage":"https://github.com/node-modules/ylru","repository":{"type":"git","url":"git://github.com/node-modules/ylru.git"},"dependencies":{},"devDependencies":{"beautify-benchmark":"^0.2.4","benchmark":"^2.1.3","egg-bin":"^1.10.0","eslint":"^3.12.2","eslint-config-egg":"^3.2.0","hashlru":"^1.0.3","ko-sleep":"^1.0.2","lru-cache":"^4.0.2"},"main":"index.js","scripts":{"lint":"eslint test *.js","test":"npm run lint -- --fix && npm run test-local","test-local":"egg-bin test","cov":"egg-bin cov","ci":"npm run lint && npm run cov","autod":"autod"},"author":{"name":"fengmk2"},"engines":{"node":">= 4.0.0"},"license":"MIT","gitHead":"aadcb9af7c66d1e5301fc9bbf06c6bff8a8f8d62","bugs":{"url":"https://github.com/node-modules/ylru/issues"},"_id":"ylru@1.3.0","_nodeVersion":"10.16.0","_npmVersion":"6.14.8","dist":{"shasum":"b08c8541d90eeb0b083bd277742d079d9863403b","size":3233,"noattachment":false,"key":"/ylru/-/ylru-1.3.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/ylru/download/ylru-1.3.0.tgz"},"_npmUser":{"name":"dead_horse","email":"dead_horse@qq.com"},"directories":{},"maintainers":[{"name":"dead-horse","email":""},{"name":"dead_horse","email":"dead_horse@qq.com"},{"name":"fengmk2","email":"fengmk2@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ylru_1.3.0_1647400297142_0.17563727611987545"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2022-03-16T03:11:53.229Z","publish_time":1647400297486,"_cnpm_publish_time":1647400297486},"1.2.1":{"name":"ylru","description":"Extends LRU base on hashlru","version":"1.2.1","homepage":"https://github.com/node-modules/ylru","repository":{"type":"git","url":"git://github.com/node-modules/ylru.git"},"dependencies":{},"devDependencies":{"beautify-benchmark":"^0.2.4","benchmark":"^2.1.3","egg-bin":"^1.10.0","eslint":"^3.12.2","eslint-config-egg":"^3.2.0","hashlru":"^1.0.3","ko-sleep":"^1.0.2","lru-cache":"^4.0.2"},"main":"index.js","files":["index.js"],"scripts":{"lint":"eslint test *.js","test":"npm run lint -- --fix && npm run test-local","test-local":"egg-bin test","cov":"egg-bin cov","ci":"npm run lint && npm run cov","autod":"autod"},"author":{"name":"fengmk2"},"engines":{"node":">= 4.0.0"},"license":"MIT","gitHead":"77d41e92949b5dee1569a1476307b4dd2d96c273","bugs":{"url":"https://github.com/node-modules/ylru/issues"},"_id":"ylru@1.2.1","_npmVersion":"5.8.0","_nodeVersion":"8.11.1","_npmUser":{"name":"dead_horse","email":"dead_horse@qq.com"},"dist":{"shasum":"f576b63341547989c1de7ba288760923b27fe84f","size":2997,"noattachment":false,"key":"/ylru/-/ylru-1.2.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/ylru/download/ylru-1.2.1.tgz"},"maintainers":[{"name":"dead-horse","email":""},{"name":"dead_horse","email":"dead_horse@qq.com"},{"name":"fengmk2","email":"fengmk2@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ylru_1.2.1_1531301612540_0.18408402711026928"},"_hasShrinkwrap":false,"publish_time":1531301612621,"_cnpm_publish_time":1531301612621},"1.2.0":{"name":"ylru","description":"Extends LRU base on hashlru","version":"1.2.0","homepage":"https://github.com/node-modules/ylru","repository":{"type":"git","url":"git://github.com/node-modules/ylru.git"},"dependencies":{},"devDependencies":{"beautify-benchmark":"^0.2.4","benchmark":"^2.1.3","egg-bin":"^1.10.0","eslint":"^3.12.2","eslint-config-egg":"^3.2.0","hashlru":"^1.0.3","ko-sleep":"^1.0.2","lru-cache":"^4.0.2"},"main":"index.js","files":["index.js"],"scripts":{"lint":"eslint test *.js","test":"npm run lint -- --fix && npm run test-local","test-local":"egg-bin test","cov":"egg-bin cov","ci":"npm run lint && npm run cov","autod":"autod"},"author":{"name":"fengmk2"},"engines":{"node":">= 4.0.0"},"license":"MIT","gitHead":"ee48c6ef101c66904228eb0b6d3c654a2c6a01c7","bugs":{"url":"https://github.com/node-modules/ylru/issues"},"_id":"ylru@1.2.0","_shasum":"8337f5e1475228df7ba8cc590cf76ac27b665095","_from":".","_npmVersion":"3.10.10","_nodeVersion":"8.0.0","_npmUser":{"name":"dead_horse","email":"dead_horse@qq.com"},"dist":{"shasum":"8337f5e1475228df7ba8cc590cf76ac27b665095","size":2863,"noattachment":false,"key":"/ylru/-/ylru-1.2.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/ylru/download/ylru-1.2.0.tgz"},"maintainers":[{"name":"dead-horse","email":""},{"name":"dead_horse","email":"dead_horse@qq.com"},{"name":"fengmk2","email":"fengmk2@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ylru-1.2.0.tgz_1500356636454_0.10072643007151783"},"directories":{},"publish_time":1500356636573,"_hasShrinkwrap":false,"_cnpm_publish_time":1500356636573},"1.1.0":{"name":"ylru","description":"Extends LRU base on hashlru","version":"1.1.0","homepage":"https://github.com/node-modules/ylru","repository":{"type":"git","url":"git://github.com/node-modules/ylru.git"},"dependencies":{},"devDependencies":{"beautify-benchmark":"^0.2.4","benchmark":"^2.1.3","egg-bin":"^1.10.0","eslint":"^3.12.2","eslint-config-egg":"^3.2.0","hashlru":"^1.0.3","ko-sleep":"^1.0.2","lru-cache":"^4.0.2"},"main":"index.js","files":["index.js"],"scripts":{"lint":"eslint test *.js","test":"npm run lint -- --fix && npm run test-local","test-local":"egg-bin test","cov":"egg-bin cov","ci":"npm run lint && npm run cov","autod":"autod"},"author":{"name":"fengmk2"},"engines":{"node":">= 4.0.0"},"license":"MIT","gitHead":"1f5efa5a852db3754e40470a9410663c0d12715a","bugs":{"url":"https://github.com/node-modules/ylru/issues"},"_id":"ylru@1.1.0","_npmVersion":"5.0.3","_nodeVersion":"8.1.3","_npmUser":{"name":"fengmk2","email":"fengmk2@gmail.com"},"dist":{"shasum":"012612cae11062533944e36c9cb6a78a3aa3ec9a","size":2544,"noattachment":false,"key":"/ylru/-/ylru-1.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/ylru/download/ylru-1.1.0.tgz"},"maintainers":[{"name":"dead-horse","email":""},{"name":"dead_horse","email":"dead_horse@qq.com"},{"name":"fengmk2","email":"fengmk2@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/ylru-1.1.0.tgz_1499158995490_0.06412839842960238"},"directories":{},"publish_time":1499158995619,"_hasShrinkwrap":false,"_cnpm_publish_time":1499158995619},"1.0.0":{"name":"ylru","description":"Extends LRU base on hashlru","version":"1.0.0","homepage":"https://github.com/node-modules/ylru","repository":{"type":"git","url":"git://github.com/node-modules/ylru.git"},"dependencies":{},"devDependencies":{"beautify-benchmark":"^0.2.4","benchmark":"^2.1.3","egg-bin":"^1.10.0","egg-ci":"^1.1.0","eslint":"^3.12.2","eslint-config-egg":"^3.2.0","hashlru":"^1.0.3","ko-sleep":"^1.0.2","lru-cache":"^4.0.2"},"main":"index.js","files":["index.js"],"scripts":{"lint":"eslint test *.js","test":"npm run lint -- --fix && npm run test-local","test-local":"egg-bin test","cov":"egg-bin cov","ci":"npm run lint && npm run cov","autod":"autod"},"author":{"name":"fengmk2"},"engines":{"node":">= 4.0.0"},"ci":{"version":"4, 6, 7"},"license":"MIT","gitHead":"beaebe5918b911620cb044fceac73d527c3c4e94","bugs":{"url":"https://github.com/node-modules/ylru/issues"},"_id":"ylru@1.0.0","_shasum":"e163650928457d3c51e80914723b708145ae9ff0","_from":".","_npmVersion":"3.10.9","_nodeVersion":"6.9.2","_npmUser":{"name":"fengmk2","email":"fengmk2@gmail.com"},"dist":{"shasum":"e163650928457d3c51e80914723b708145ae9ff0","size":2445,"noattachment":false,"key":"/ylru/-/ylru-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/ylru/download/ylru-1.0.0.tgz"},"maintainers":[{"name":"dead-horse","email":""},{"name":"dead_horse","email":"dead_horse@qq.com"},{"name":"fengmk2","email":"fengmk2@gmail.com"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/ylru-1.0.0.tgz_1483017335276_0.7584457800257951"},"directories":{},"publish_time":1483017335491,"_cnpm_publish_time":1483017335491,"_hasShrinkwrap":false},"0.0.1":{"name":"ylru","description":"Extends LRU base on hashlru","version":"0.0.1","homepage":"https://github.com/node-modules/ylru","repository":{"type":"git","url":"git://github.com/node-modules/ylru.git"},"dependencies":{},"devDependencies":{"egg-bin":"^1.10.0","egg-ci":"^1.1.0","eslint":"^3.12.2","eslint-config-egg":"^3.2.0","ko-sleep":"^1.0.2"},"main":"index.js","files":["index.js"],"scripts":{"lint":"eslint test *.js","test":"npm run lint -- --fix && npm run test-local","test-local":"egg-bin test","cov":"egg-bin cov","ci":"npm run lint && npm run cov","autod":"autod"},"author":{"name":"fengmk2"},"engines":{"node":">= 4.0.0"},"ci":{"version":"4, 6, 7"},"license":"MIT","gitHead":"29ac7961bb122735039ec57ef7719638cb02ced4","bugs":{"url":"https://github.com/node-modules/ylru/issues"},"_id":"ylru@0.0.1","_shasum":"2fb1b48e801f80f3a539c5db6549ddb3f83e9c8d","_from":".","_npmVersion":"3.10.8","_nodeVersion":"7.0.0-nightly20161228ddd22d6204","_npmUser":{"name":"fengmk2","email":"fengmk2@gmail.com"},"dist":{"shasum":"2fb1b48e801f80f3a539c5db6549ddb3f83e9c8d","size":2030,"noattachment":false,"key":"/ylru/-/ylru-0.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/ylru/download/ylru-0.0.1.tgz"},"maintainers":[{"name":"dead-horse","email":""},{"name":"dead_horse","email":"dead_horse@qq.com"},{"name":"fengmk2","email":"fengmk2@gmail.com"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/ylru-0.0.1.tgz_1482996060114_0.11768422438763082"},"directories":{},"publish_time":1482996060334,"_cnpm_publish_time":1482996060334,"_hasShrinkwrap":false}},"readme":"# ylru\n\n[![NPM version][npm-image]][npm-url]\n[![Node.js CI](https://github.com/node-modules/ylru/actions/workflows/nodejs.yml/badge.svg)](https://github.com/node-modules/ylru/actions/workflows/nodejs.yml)\n[![Test coverage][codecov-image]][codecov-url]\n[![Known Vulnerabilities][snyk-image]][snyk-url]\n[![npm download][download-image]][download-url]\n\n[npm-image]: https://img.shields.io/npm/v/ylru.svg?style=flat-square\n[npm-url]: https://npmjs.org/package/ylru\n[codecov-image]: https://img.shields.io/codecov/c/github/node-modules/ylru.svg?style=flat-square\n[codecov-url]: https://codecov.io/github/node-modules/ylru?branch=master\n[snyk-image]: https://snyk.io/test/npm/ylru/badge.svg?style=flat-square\n[snyk-url]: https://snyk.io/test/npm/ylru\n[download-image]: https://img.shields.io/npm/dm/ylru.svg?style=flat-square\n[download-url]: https://npmjs.org/package/ylru\n\n**hashlru inspired**\n\n[hashlru](https://github.com/dominictarr/hashlru) is the **Simpler, faster LRU cache algorithm.**\nPlease checkout [algorithm](https://github.com/dominictarr/hashlru#algorithm) and [complexity](https://github.com/dominictarr/hashlru#complexity) on hashlru.\n\nylru extends some features base on hashlru:\n\n- cache value can be **expired**.\n- cache value can be **empty value**, e.g.: `null`, `undefined`, `''`, `0`\n\n## Usage\n\n```ts\nimport { LRU } from 'ylru';\n\nconst lru = new LRU(100);\nlru.set(key, value);\nlru.get(key);\n\n// value2 will be expired after 5000ms\nlru.set(key2, value2, { maxAge: 5000 });\n// get key and update expired\nlru.get(key2, { maxAge: 5000 });\n```\n\n### API\n\n## new LRU(max) => lru\n\ninitialize a lru object.\n\n### lru.get(key[, options]) => value | null\n\n- `{Number} options.maxAge`: update expire time when get, value will become `undefined` after `maxAge` pass.\n\nReturns the value in the cache.\n\n### lru.set(key, value[, options])\n\n- `{Number} options.maxAge`: value will become `undefined` after `maxAge` pass.\nIf `maxAge` not set, value will be never expired.\n\nSet the value for key.\n\n### lru.keys()\n\nGet all unexpired cache keys from lru, due to the strategy of ylru, the `keys`' length may greater than `max`.\n\n```ts\nconst lru = new LRU(3);\n\nlru.set('key 1', 'value 1');\nlru.set('key 2', 'value 2');\nlru.set('key 3', 'value 3');\nlru.set('key 4', 'value 4');\n\nlru.keys(); // [ 'key 4', 'key 1', 'key 2', 'key 3']\n// cache: {\n//   'key 4': 'value 4',\n// }\n// _cache: {\n//   'key 1': 'value 1',\n//   'key 2': 'value 2',\n//   'key 3': 'value 3',\n// }\n```\n\n### lru.reset()\n\nreset a lru object.\n\n```ts\nconst lru = new LRU(3);\n\nlru.set('key 1', 'value 1');\nlru.set('key 2', 'value 2');\nlru.set('key 3', 'value 3');\nlru.set('key 4', 'value 4');\n\nlru.reset();\n// cache: {\n// }\n// _cache: {\n// }\n\nlru.keys().length === 0;\n```\n\n## License\n\n[MIT](LICENSE)\n\n<!-- GITCONTRIBUTOR_START -->\n\n## Contributors\n\n|[<img src=\"https://avatars.githubusercontent.com/u/156269?v=4\" width=\"100px;\"/><br/><sub><b>fengmk2</b></sub>](https://github.com/fengmk2)<br/>|[<img src=\"https://avatars.githubusercontent.com/u/259374?v=4\" width=\"100px;\"/><br/><sub><b>dominictarr</b></sub>](https://github.com/dominictarr)<br/>|[<img src=\"https://avatars.githubusercontent.com/u/985607?v=4\" width=\"100px;\"/><br/><sub><b>dead-horse</b></sub>](https://github.com/dead-horse)<br/>|[<img src=\"https://avatars.githubusercontent.com/u/958063?v=4\" width=\"100px;\"/><br/><sub><b>thonatos</b></sub>](https://github.com/thonatos)<br/>|[<img src=\"https://avatars.githubusercontent.com/u/25395?v=4\" width=\"100px;\"/><br/><sub><b>mourner</b></sub>](https://github.com/mourner)<br/>|[<img src=\"https://avatars.githubusercontent.com/u/32174276?v=4\" width=\"100px;\"/><br/><sub><b>semantic-release-bot</b></sub>](https://github.com/semantic-release-bot)<br/>|\n| :---: | :---: | :---: | :---: | :---: | :---: |\n[<img src=\"https://avatars.githubusercontent.com/u/6828924?v=4\" width=\"100px;\"/><br/><sub><b>vagusX</b></sub>](https://github.com/vagusX)<br/>|[<img src=\"https://avatars.githubusercontent.com/u/566097?v=4\" width=\"100px;\"/><br/><sub><b>RaoHai</b></sub>](https://github.com/RaoHai)<br/>\n\nThis project follows the git-contributor [spec](https://github.com/xudafeng/git-contributor), auto updated at `Thu Mar 28 2024 11:52:18 GMT+0800`.\n\n<!-- GITCONTRIBUTOR_END -->\n","_attachments":{},"homepage":"https://github.com/node-modules/ylru","bugs":{"url":"https://github.com/node-modules/ylru/issues"},"license":"MIT"}