lru.min is a fast, efficient, and lightweight LRU (Least Recently Used) cache library for JavaScript. Current stable version is 1.1.4. It supports Node.js (>=8), Bun, Deno, and browsers with ES6+. Unlike other LRU caches, it offers high compatibility and performance comparable to popular alternatives. It ships TypeScript types and has a simple API with features like resize, peek, and eviction callbacks. Development is active with regular updates on GitHub.
npm install lru.minNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Demonstrates creating an LRU cache with max size and eviction callback, setting and getting values, peeking, deleting, and clearing.
Use `onEviction` (with 'i') when creating the cache.
Avoid using `undefined` as a key; it will not be stored.
Call `LRU.clear()` instead of `LRU.evict(LRU.size)` to clear all cache.
Run `npm install lru.min` and ensure tsconfig.json has `"moduleResolution": "node"` or `"nodenext"`.
Change `import createLRU from 'lru.min'` to `import { createLRU } from 'lru.min'`.Use `import { createLRU } from 'lru.min'` or switch to CommonJS by setting `"type": "commonjs"` in package.json.No dependency data recorded yet.