A TypeScript-native LRU cache implementation with no runtime dependencies. Current stable version is 2.0.0. Uses a Map for internal storage, supporting any key type including reference types. Provides optional clone functionality, per-entry TTL, and eviction callbacks. Unlike other LRU caches (e.g., lru-cache), this package ships TypeScript source code and type definitions, and has a smaller API surface focusing on simplicity.
npm install typescript-lru-cacheNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Creates an LRU cache with maxSize 3, adds four entries, demonstrating eviction of least recently used 'a' when 'd' is added.
Set maxSize explicitly if larger limit is needed, or expect eviction after 25 entries.
Provide custom cloneFn if cloning non-serializable values.
Call cache.delete(key) explicitly or rely on get/set to trigger eviction.
Use `import { LRUCache } from 'typescript-lru-cache'`Use `const { LRUCache } = require('typescript-lru-cache')`Run `npm install typescript-lru-cache` and verify package.json.
No dependency data recorded yet.