{"_id":"@jbrowse/quick-lru","_rev":"5-2b5be58abf365c1fa2fa7eca7da85db2","name":"@jbrowse/quick-lru","dist-tags":{"latest":"7.3.5"},"versions":{"7.3.2":{"name":"@jbrowse/quick-lru","version":"7.3.2","keywords":["lru","quick","cache","caching","least","recently","used","fast","map","hash","buffer"],"author":{"url":"https://sindresorhus.com","name":"Sindre Sorhus","email":"sindresorhus@gmail.com"},"license":"MIT","_id":"@jbrowse/quick-lru@7.3.2","maintainers":[{"name":"garrettjstevens","email":"stevens.garrett.j@gmail.com"},{"name":"eahershberg","email":"eahershberg@gmail.com"},{"name":"peterkxie","email":"peterkxie@gmail.com"},{"name":"teresam856","email":"tere486martinez@gmail.com"},{"name":"rbuels","email":"rbuels@gmail.com"},{"name":"cmdcolin","email":"colin.diesh@gmail.com"}],"dist":{"shasum":"2bc5d72c8a234a616a615ea475a0969030b2f5d9","tarball":"https://registry.npmjs.org/@jbrowse/quick-lru/-/quick-lru-7.3.2.tgz","fileCount":16,"integrity":"sha512-BTWSGUJqpKn7fd7GLYHaQDk5lSQdpwnpXFmz8k992JfMtFNeKlMqMuLGRQmYez/UBiq6Mcvczjh0lfkl6uoBtA==","signatures":[{"sig":"MEUCIQDI6lAn2EW20M5KhoTPWGkl2aRlnT5c3xOYFrIoqyghuQIgMGzs4F+Wfs4uV6cfHkH0Mxe1NwvZiXG3yf/aEbg/orM=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":73634},"type":"module","types":"./dist/index.d.ts","engines":{"node":">=18"},"exports":{"import":{"import":"./esm/index.js"},"require":{"require":"./dist/index.js"}},"scripts":{"lint":"eslint --report-unused-disable-directives --max-warnings 0","test":"vitest","build":"yarn build:esm && yarn build:es5","clean":"rimraf dist esm","format":"prettier --write .","prebuild":"yarn clean","build:es5":"tsc --module commonjs --outDir dist","build:esm":"tsc --outDir esm","preversion":"yarn lint && yarn test --run && yarn build","postversion":"git push --follow-tags","postbuild:es5":"echo '{\"type\": \"commonjs\"}' > dist/package.json"},"_npmUser":{"name":"cmdcolin","email":"colin.diesh@gmail.com"},"repository":{"url":"https://github.com/cmdcolin/quick-lru.git","type":"git"},"description":"Simple “Least Recently Used” (LRU) cache, forked from sindresorhus/quick-lru for CJS","directories":{},"licenseText":"MIT License\n\nCopyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n","sideEffects":false,"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"eslint":"^9.39.2","rimraf":"^6.1.2","vitest":"^4.0.16","prettier":"^3.7.4","typescript":"^5.9.3","typescript-eslint":"^8.50.0","eslint-plugin-import":"^2.32.0","eslint-plugin-unicorn":"^62.0.0"},"_npmOperationalInternal":{"tmp":"tmp/quick-lru_7.3.2_1766005738526_0.45464692292527387","host":"s3://npm-registry-packages-npm-production"}},"7.3.3":{"name":"@jbrowse/quick-lru","version":"7.3.3","keywords":["lru","quick","cache","caching","least","recently","used","fast","map","hash","buffer"],"author":{"url":"https://sindresorhus.com","name":"Sindre Sorhus","email":"sindresorhus@gmail.com"},"license":"MIT","_id":"@jbrowse/quick-lru@7.3.3","maintainers":[{"name":"garrettjstevens","email":"stevens.garrett.j@gmail.com"},{"name":"eahershberg","email":"eahershberg@gmail.com"},{"name":"peterkxie","email":"peterkxie@gmail.com"},{"name":"teresam856","email":"tere486martinez@gmail.com"},{"name":"rbuels","email":"rbuels@gmail.com"},{"name":"cmdcolin","email":"colin.diesh@gmail.com"}],"dist":{"shasum":"4f54cb440f181ef0e7f05e2f6d81bece74778768","tarball":"https://registry.npmjs.org/@jbrowse/quick-lru/-/quick-lru-7.3.3.tgz","fileCount":15,"integrity":"sha512-5eS2C6YVwesE59jfU7Aab7GyRK2KvZ5wU2dYsDbNNrN0QRGj1uuw3wpBdiw17VEDn0NQQz6pc1RYgT9RSyFwFQ==","signatures":[{"sig":"MEUCIC1ZS5Y4PKQFJWQ9QuZNRJE75PZ1R6SIdtwsz3QN+nN6AiEAt7vSfUV/FyklgoDAZkGobONreJtw8dtdFA8hJuIfKMI=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":91941},"type":"module","types":"./dist/index.d.ts","engines":{"node":">=18"},"exports":{"import":{"import":"./esm/index.js"},"require":{"require":"./dist/index.js"}},"scripts":{"lint":"eslint --report-unused-disable-directives --max-warnings 0","test":"vitest","build":"yarn build:esm && yarn build:es5","clean":"rimraf dist esm","format":"prettier --write .","prebuild":"yarn clean","build:es5":"tsc --module commonjs --outDir dist","build:esm":"tsc --outDir esm","preversion":"yarn lint && yarn test --run && yarn build","postversion":"git push --follow-tags","postbuild:es5":"echo '{\"type\": \"commonjs\"}' > dist/package.json"},"_npmUser":{"name":"cmdcolin","email":"colin.diesh@gmail.com"},"repository":{"url":"https://github.com/cmdcolin/quick-lru.git","type":"git"},"description":"Simple “Least Recently Used” (LRU) cache, forked from sindresorhus/quick-lru for CJS","directories":{},"licenseText":"MIT License\n\nCopyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n","sideEffects":false,"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"eslint":"^9.39.2","rimraf":"^6.1.2","vitest":"^4.0.16","prettier":"^3.7.4","typescript":"^5.9.3","typescript-eslint":"^8.50.0","eslint-plugin-import":"^2.32.0","eslint-plugin-unicorn":"^62.0.0"},"_npmOperationalInternal":{"tmp":"tmp/quick-lru_7.3.3_1766007067633_0.30473298098159773","host":"s3://npm-registry-packages-npm-production"}},"7.3.4":{"name":"@jbrowse/quick-lru","version":"7.3.4","keywords":["lru","quick","cache","caching","least","recently","used","fast","map","hash","buffer"],"author":{"url":"https://sindresorhus.com","name":"Sindre Sorhus","email":"sindresorhus@gmail.com"},"license":"MIT","_id":"@jbrowse/quick-lru@7.3.4","maintainers":[{"name":"garrettjstevens","email":"stevens.garrett.j@gmail.com"},{"name":"eahershberg","email":"eahershberg@gmail.com"},{"name":"peterkxie","email":"peterkxie@gmail.com"},{"name":"teresam856","email":"tere486martinez@gmail.com"},{"name":"rbuels","email":"rbuels@gmail.com"},{"name":"cmdcolin","email":"colin.diesh@gmail.com"}],"dist":{"shasum":"8f070e638a1eee8c15332844f768da029b44524d","tarball":"https://registry.npmjs.org/@jbrowse/quick-lru/-/quick-lru-7.3.4.tgz","fileCount":16,"integrity":"sha512-DgmoXhq9q/o/bXRVXWBD4d5AZP1QVZOQwQLFV/anOFDFrzPOgL1e3fRy7B7K/g8VHwO6b1s1p/i8CwEdkm1HZA==","signatures":[{"sig":"MEUCIHKiHlj6qLz+zmV0ljctL3S1YD74vUOV68mTUHJd4DNdAiEA+FxoE2GdrmSuBxCE6mD0mNxNB4J6VNTCGvHtVbpAExA=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":81851},"type":"module","types":"./dist/index.d.ts","engines":{"node":">=18"},"exports":{"import":{"import":"./esm/index.js"},"require":{"require":"./dist/index.js"}},"scripts":{"lint":"eslint --report-unused-disable-directives --max-warnings 0","test":"vitest","build":"yarn build:esm && yarn build:es5 && cp src/index.d.ts esm && cp src/index.d.ts dist","clean":"rimraf dist esm","format":"prettier --write .","prebuild":"yarn clean","build:es5":"tsc --module commonjs --outDir dist","build:esm":"tsc --outDir esm","preversion":"yarn lint && yarn test --run && yarn build","postversion":"git push --follow-tags","postbuild:es5":"echo '{\"type\": \"commonjs\"}' > dist/package.json"},"_npmUser":{"name":"cmdcolin","email":"colin.diesh@gmail.com"},"repository":{"url":"https://github.com/cmdcolin/quick-lru.git","type":"git"},"description":"Simple “Least Recently Used” (LRU) cache, forked from sindresorhus/quick-lru for CJS","directories":{},"licenseText":"MIT License\n\nCopyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n","sideEffects":false,"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"eslint":"^9.39.2","rimraf":"^6.1.2","vitest":"^4.0.16","prettier":"^3.7.4","typescript":"^5.9.3","typescript-eslint":"^8.50.0","eslint-plugin-import":"^2.32.0","eslint-plugin-unicorn":"^62.0.0"},"_npmOperationalInternal":{"tmp":"tmp/quick-lru_7.3.4_1766007397234_0.12370240233413332","host":"s3://npm-registry-packages-npm-production"}},"7.3.5":{"name":"@jbrowse/quick-lru","version":"7.3.5","keywords":["lru","quick","cache","caching","least","recently","used","fast","map","hash","buffer"],"author":{"url":"https://sindresorhus.com","name":"Sindre Sorhus","email":"sindresorhus@gmail.com"},"license":"MIT","_id":"@jbrowse/quick-lru@7.3.5","maintainers":[{"name":"garrettjstevens","email":"stevens.garrett.j@gmail.com"},{"name":"eahershberg","email":"eahershberg@gmail.com"},{"name":"peterkxie","email":"peterkxie@gmail.com"},{"name":"teresam856","email":"tere486martinez@gmail.com"},{"name":"rbuels","email":"rbuels@gmail.com"},{"name":"cmdcolin","email":"colin.diesh@gmail.com"}],"dist":{"shasum":"8625677d7e22050acfdefe5afa23b3eca701955b","tarball":"https://registry.npmjs.org/@jbrowse/quick-lru/-/quick-lru-7.3.5.tgz","fileCount":16,"integrity":"sha512-DPEtODWKt+QGmCg+EO36sSmKOmdjJOwtxeV/4PBnf+7jqC/P7R4YIz+/yohtqh9UZ38dbLtXIlmigPlkZy8SAA==","signatures":[{"sig":"MEYCIQCEKvFfDkO8qpbq8OeV8/51q+wXodeANEHm33phc2GwEwIhAKr6McqNUj1RMlyXg8IC/FRiFdWz5i+fyPDxmvYYV7vU","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":82895},"type":"module","types":"./dist/index.d.ts","engines":{"node":">=18"},"exports":{"import":{"import":"./esm/index.js"},"require":{"require":"./dist/index.js"}},"scripts":{"lint":"eslint --report-unused-disable-directives --max-warnings 0","test":"vitest","build":"yarn build:esm && yarn build:es5 && cp src/index.d.ts esm && cp src/index.d.ts dist","clean":"rimraf dist esm","format":"prettier --write .","prebuild":"yarn clean","build:es5":"tsc --module commonjs --outDir dist","build:esm":"tsc --outDir esm","preversion":"yarn lint && yarn test --run && yarn build","postversion":"git push --follow-tags","postbuild:es5":"echo '{\"type\": \"commonjs\"}' > dist/package.json"},"_npmUser":{"name":"cmdcolin","email":"colin.diesh@gmail.com"},"repository":{"url":"https://github.com/cmdcolin/quick-lru.git","type":"git"},"description":"Simple “Least Recently Used” (LRU) cache, forked from sindresorhus/quick-lru for CJS","directories":{},"licenseText":"MIT License\n\nCopyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n","sideEffects":false,"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"eslint":"^9.39.2","rimraf":"^6.1.2","vitest":"^4.0.16","prettier":"^3.7.4","typescript":"^5.9.3","typescript-eslint":"^8.50.0","eslint-plugin-import":"^2.32.0","eslint-plugin-unicorn":"^62.0.0"},"_npmOperationalInternal":{"tmp":"tmp/quick-lru_7.3.5_1766007590463_0.9410783492117862","host":"s3://npm-registry-packages-npm-production"}}},"time":{"created":"2025-12-17T21:08:58.468Z","modified":"2026-04-16T18:39:56.059Z","7.3.2":"2025-12-17T21:08:58.667Z","7.3.3":"2025-12-17T21:31:07.791Z","7.3.4":"2025-12-17T21:36:37.378Z","7.3.5":"2025-12-17T21:39:50.659Z"},"author":{"url":"https://sindresorhus.com","name":"Sindre Sorhus","email":"sindresorhus@gmail.com"},"license":"MIT","keywords":["lru","quick","cache","caching","least","recently","used","fast","map","hash","buffer"],"repository":{"url":"https://github.com/cmdcolin/quick-lru.git","type":"git"},"description":"Simple “Least Recently Used” (LRU) cache, forked from sindresorhus/quick-lru for CJS","maintainers":[{"email":"stevens.garrett.j@gmail.com","name":"garrettjstevens"},{"email":"rbuels@gmail.com","name":"rbuels"},{"email":"colin.diesh@gmail.com","name":"cmdcolin"}],"readme":"# quick-lru [![Coverage Status](https://codecov.io/gh/sindresorhus/quick-lru/branch/main/graph/badge.svg)](https://codecov.io/gh/sindresorhus/quick-lru/branch/main)\n\n> Simple\n> [“Least Recently Used” (LRU) cache](https://en.m.wikipedia.org/wiki/Cache_replacement_policies#Least_Recently_Used_.28LRU.29)\n\nUseful when you need to cache something and limit memory usage.\n\nSee the [algorithm section](#algorithm) for implementation details.\n\n## Install\n\n```sh\nnpm install quick-lru\n```\n\n## Usage\n\n```js\nimport QuickLRU from 'quick-lru'\n\nconst lru = new QuickLRU({ maxSize: 1000 })\n\nlru.set('🦄', '🌈')\n\nlru.has('🦄')\n//=> true\n\nlru.get('🦄')\n//=> '🌈'\n```\n\n## API\n\n### new QuickLRU(options?)\n\nReturns a new instance.\n\nIt's a\n[`Map`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Map)\nsubclass.\n\n### options\n\nType: `object`\n\n#### maxSize\n\n_Required_\\\nType: `number`\n\nThe target maximum number of items before evicting the least recently used\nitems.\n\n> [!NOTE] This package uses an [algorithm](#algorithm) which maintains between\n> `maxSize` and `2 × maxSize` items for performance reasons. The cache may\n> temporarily contain up to twice the specified size due to the dual-cache\n> design that avoids expensive delete operations.\n\n#### maxAge\n\nType: `number`\\\nDefault: `Infinity`\n\nThe maximum number of milliseconds an item should remain in the cache. By\ndefault, `maxAge` will be `Infinity`, which means that items will never expire.\n\nLazy expiration occurs upon the next `write` or `read` call.\n\nIndividual expiration of an item can be specified by the\n`set(key, value, options)` method.\n\n#### onEviction\n\n_Optional_\\\nType: `(key, value) => void`\n\nCalled right before an item is evicted from the cache due to LRU pressure, TTL\nexpiration, or manual eviction via `evict()`.\n\nUseful for side effects or for items like object URLs that need explicit cleanup\n(`revokeObjectURL`).\n\n> [!NOTE] This callback is **not** called for manual removals via `delete()` or\n> `clear()`. It fires for automatic evictions and manual evictions via\n> `evict()`.\n\n### Instance\n\nThe instance is an\n[`Iterable`](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Iteration_protocols)\nof `[key, value]` pairs so you can use it directly in a\n[`for…of`](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Statements/for...of)\nloop.\n\nBoth `key` and `value` can be of any type.\n\n#### .set(key, value, options?)\n\nSet an item. Returns the instance.\n\nIndividual expiration of an item can be specified with the `maxAge` option. If\nnot specified, the global `maxAge` value will be used in case it is specified in\nthe constructor; otherwise, the item will never expire.\n\n#### .get(key)\n\nGet an item.\n\n#### .has(key)\n\nCheck if an item exists.\n\n#### .peek(key)\n\nGet an item without marking it as recently used.\n\n#### .delete(key)\n\nDelete an item.\n\nReturns `true` if the item is removed or `false` if the item doesn't exist.\n\n#### .clear()\n\nDelete all items.\n\n#### .expiresIn(key)\n\nGet the remaining time to live (in milliseconds) for the given item, or\n`undefined` if the item is not in the cache.\n\n- Does not mark the item as recently used.\n- Does not trigger lazy expiration or remove the entry when it’s expired.\n- Returns `Infinity` if the item has no expiration (`maxAge` not set for the\n  item and no global `maxAge`).\n- May return a negative number if the item has already expired but has not yet\n  been lazily removed.\n\n#### .resize(maxSize)\n\nUpdate the `maxSize`, discarding items as necessary. Insertion order is mostly\npreserved, though this is not a strong guarantee.\n\nUseful for on-the-fly tuning of cache sizes in live systems.\n\n#### .evict(count?)\n\nEvict the least recently used items from the cache.\n\nThe `count` parameter specifies how many items to evict. Defaults to 1.\n\nIt will always keep at least one item in the cache.\n\n```js\nimport QuickLRU from 'quick-lru'\n\nconst lru = new QuickLRU({ maxSize: 10 })\n\nlru.set('a', 1)\nlru.set('b', 2)\nlru.set('c', 3)\n\nlru.evict(2) // Evicts 'a' and 'b'\n\nconsole.log(lru.has('a'))\n//=> false\n\nconsole.log(lru.has('c'))\n//=> true\n```\n\n#### .keys()\n\nIterable for all the keys.\n\n#### .values()\n\nIterable for all the values.\n\n#### .entriesAscending()\n\nIterable for all entries, starting with the oldest (ascending in recency).\n\n#### .entriesDescending()\n\nIterable for all entries, starting with the newest (descending in recency).\n\n#### .entries()\n\nIterable for all entries, starting with the oldest (ascending in recency).\n\n**This method exists for `Map` compatibility. Prefer\n[.entriesAscending()](#entriesascending) instead.**\n\n#### .forEach(callbackFunction, thisArgument)\n\nLoop over entries calling the `callbackFunction` for each entry (ascending in\nrecency).\n\n**This method exists for `Map` compatibility. Prefer\n[.entriesAscending()](#entriesascending) instead.**\n\n#### .size _(getter)_\n\nThe stored item count.\n\n#### .maxSize _(getter)_\n\nThe set max size.\n\n#### .maxAge _(getter)_\n\nThe set max age.\n\n## Algorithm\n\nThis library implements a variant of the\n[hashlru algorithm](https://github.com/dominictarr/hashlru#algorithm) using\nJavaScript's `Map` for broader key type support.\n\n### How it works\n\nThe algorithm uses a dual-cache approach with two `Map` objects:\n\n1. New cache - Stores recently accessed items\n2. Old cache - Stores less recently accessed items\n\nOn `set()` operations:\n\n- If the key exists in the new cache, update it\n- Otherwise, add the key-value pair to the new cache\n- When the new cache reaches `maxSize`, promote it to become the old cache and\n  create a fresh new cache\n\nOn `get()` operations:\n\n- If the key is in the new cache, return it directly\n- If the key is in the old cache, move it to the new cache (promoting its\n  recency)\n\n### Benefits\n\n- Performance: Avoids expensive `delete` operations that can cause performance\n  issues in JavaScript engines\n- Simplicity: No complex linked list management required\n- Cache efficiency: Maintains LRU semantics while being much faster than\n  traditional implementations\n\n### Trade-offs\n\n- Size variance: The cache can contain between `maxSize` and `2 × maxSize` items\n  temporarily\n- Memory overhead: Uses up to twice the target memory compared to strict LRU\n  implementations\n\n### When to use\n\nChoose this implementation when:\n\n- You need high-performance caching with many operations\n- You can tolerate temporary size variance for better performance\n- You want simple, reliable caching without complex data structures\n\nConsider alternatives when:\n\n- You need strict memory limits (exactly `maxSize` items)\n- Memory usage is more critical than performance\n\n## Related\n\n- [yocto-queue](https://github.com/sindresorhus/yocto-queue) - Tiny queue data\n  structure\n","readmeFilename":"readme.md"}