A minimal LRU (Least Recently Used) in-memory cache for Node.js, version 2.0.4. This package provides a straightforward caching solution with configurable maximum size (default 1000) and essential operations: set, get, has, remove, size, clear, keys, and dump. It ships with TypeScript type definitions, supports Node.js >=12, and uses the standard LRU algorithm by Dominic Tarr. Lightweight with no external dependencies.
npm install simple.cacheNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows creating an LRU cache with max size, basic operations (set, get, has, remove, size, keys, dump, clear), and LRU eviction behavior.
Use import SimpleCache from 'simple.cache' instead of require('simple.cache').Call SimpleCache(max) directly without 'new'.
Do not expect a return from set(); it simply adds/updates the entry.
Always pass a positive integer to SimpleCache(max).
Use 'const cache = SimpleCache(100)' without 'new'.
Run 'npm install simple.cache' and use correct import: 'import SimpleCache from 'simple.cache''.
Ensure you have version 2.x or use CommonJS: 'const SimpleCache = require('simple.cache')'.No dependency data recorded yet.