{"name":"ylru","version":"1.3.2","author":{"name":"fengmk2"},"license":"MIT","_id":"ylru@1.3.2","homepage":"https://github.com/node-modules/ylru","bugs":{"url":"https://github.com/node-modules/ylru/issues"},"ci":{"os":{"github":"linux"},"type":"github","version":"4, 6, 8, 10, 12, 14, 16"},"dist":{"shasum":"0de48017473275a4cbdfc83a1eaf67c01af8a785","tarball":"http://registry-npm.ywwl.com/ylru/download/ylru-1.3.2.tgz","fileCount":6,"integrity":"sha512-RXRJzMiK6U2ye0BlGGZnmpwJDPgakn6aNQ0A7gHRbD4I0uvK4TW6UqkK1V0pp9jskjJBAXd3dRrbzWkqJ+6cxA==","signatures":[{"sig":"MEUCIAscvR/nHn7tOMBh5nJTV4/pIrCeifXaRxIuDC0olD1pAiEA9BrKxdTYN7F2fOhrqy1kajvVrsBWGsWJInUHYPYeXTo=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":10137,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJiMg8wACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpUlRAAm3kU/fPbdkq61Hd37iwsPxMBhgNUMKltaHZsfFQnAmClyHol\r\nKvxQrLpYEH+jdRWOlVB+kBwQxDZ4B4nFutS29gewpVY/pPhuYo2kGJeeeLTY\r\nJ2c3XaIVX6wQGnX0ADfHrjZIAeKjdzpwdrdhMPYPyjI39jt18xTwSHZEHnNP\r\ncM0T0IZIhatwc4hFVvacmv+3ogslZtES3EysNSjXALCe3I59ExNVdgAkA5eH\r\nf87hjnVc5u3GlP3PoI1Vj4vfoK9Fd1D8sLWFjftZoOVd/GQAnzk93jvKIFvm\r\nEZZ+dgoS/3gQ2Bnab/LF3+UDDD5VxDSsFdZrH5ZuopTVyJ41ldA7DICIHFrk\r\nwFflb9apozBuJe79EEVyi5NDtijZgMUc1Teug2gVwAuf4orOLoWOBGJi9T1f\r\n8saRk7vxojdl8+g2Hs1RRhIQELrt6TxnGIvumab1fnT7VQ7YwCCaUoq1+vuf\r\nAJDkVcOQHYzi/l44c4bsr6MQe0k+rvABV9exCM8oMHjsjpfgktg/bRewkwaQ\r\nmgNlmRlUFGrv2eQYevX2b+e88zPjtQDUp62dNFDVhSYdq1yBuScrJ2TbUS8x\r\n5x7PyfiDSsKJYeovt//cGou9dK0FrtYUJyORLiAUxJwoZ7+O7hHREADHBXnh\r\nyREoqsKxsAjKSKw6cPUvkHpe+JLj5WzCoIA=\r\n=nVzg\r\n-----END PGP SIGNATURE-----\r\n","size":3952,"noattachment":false,"key":"/ylru/-/ylru-1.3.2.tgz"},"main":"index.js","engines":{"node":">= 4.0.0"},"gitHead":"541d013ccd755aa4cc487d9e7734ccb2435e65e5","scripts":{"ci":"npm run lint && npm run cov","cov":"egg-bin cov","lint":"eslint test *.js","test":"npm run lint -- --fix && npm run test-local","autod":"autod","test-local":"egg-bin test","contributor":"git-contributor"},"_npmUser":{"name":"fengmk2","email":"fengmk2@gmail.com"},"repository":{"url":"git://github.com/node-modules/ylru.git","type":"git"},"_npmVersion":"6.14.12","description":"Extends LRU base on hashlru","directories":{},"_nodeVersion":"16.14.0","dependencies":{},"_hasShrinkwrap":false,"devDependencies":{"egg-ci":"^1.19.0","eslint":"^4.19.1","egg-bin":"^1.10.0","hashlru":"^1.0.3","ko-sleep":"^1.0.2","benchmark":"^2.1.3","lru-cache":"^4.0.2","runscript":"^1.5.2","typescript":"^4.6.2","@types/node":"^12.0.8","git-contributor":"^1.0.10","eslint-config-egg":"^6.0.0","beautify-benchmark":"^0.2.4"},"_npmOperationalInternal":{"tmp":"tmp/ylru_1.3.2_1647447856005_0.46935164891000425","host":"s3://npm-registry-packages"},"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","publish_time":1647447856160,"maintainers":[{"name":"dead-horse","email":"dead_horse@qq.com"},{"name":"dead_horse","email":"dead_horse@qq.com"},{"name":"fengmk2","email":"fengmk2@gmail.com"}],"_cnpm_publish_time":1647447856160,"dist-tags":{"latest":"2.0.0","release-1.x":"1.4.0"}}