LRUCache is a minimal LRU cache implementation for Node.js and browsers (v1.0.3). It uses a linked list to enforce LRU eviction; get, set, and update operations promote accessed keys. Unlike popular alternatives like lru-cache, it offers a smaller API surface with methods like staleKey() and popStale(). Active development appears stalled (last release Jul 2022, few updates). Suitable for simple caching needs where a lightweight dependency is preferred.
npm install lrucacheNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Creates an LRU cache with capacity 3, sets keys, promotes via get, and triggers eviction. Shows has(), keys(), info(), staleKey(), and popStale().
If mutation is a concern, return a deep copy of the value.
Use update() or manually remove then set to overwrite.
Call cache.removeAll() without arguments to clear all entries.
Use: import LRUCache from 'lrucache'
Run: npm install lrucache
Check key existence with has() before calling update().
No dependency data recorded yet.