Useful when you need to cache something and limit memory usage.
$ npm install quick-lru
const QuickLRU = ;const lru = maxSize: 1000;lru;lru;//=> truelru;//=> '🌈'
Returns a new instance.
The maximum number of items before evicting the least recently used items.
(key, value) => void
Called right before an item is evicted from the cache.
Useful for side effects or for items like object URLs that need explicit cleanup (
value can be of any type.
Set an item. Returns the instance.
Get an item.
Check if an item exists.
Get an item without marking it as recently used.
Delete an item.
true if the item is removed or
false if the item doesn't exist.
Delete all items.
Iterable for all the keys.
Iterable for all the values.
The stored item count.
Tidelift helps make open source sustainable for maintainers while giving companies
assurances about security, maintenance, and licensing for their dependencies.