Cache-LRU

JSON →
library 1.2.0 ·javascript
verified Jun 7, 2026

Cache-LRU is a minimal JavaScript library that provides an in-memory key-indexed cache with Least-Recently-Used (LRU) purging strategy. Current stable version is 1.2.0, released on 2025-01-27. Unlike many LRU caches (e.g., lru-cache, node-lru-cache), Cache-LRU guarantees strict O(1) time complexity for all main operations (get, set, has, del, touch, peek) including internal LRU reordering, making it suitable for performance-critical applications. It supports optional per-item expiration and a disposal callback. The library is small (≈300 lines), has zero dependencies, and works in both Node.js and browser environments. It exports a single class via CommonJS. No TypeScript types are bundled.