StringCacheMap
JSON →StringCacheMap (v1.2.0) is a high-performance, LRU-based Map implementation specifically optimized for string keys, designed as a drop-in replacement for WeakMap when keys are strings. It provides a WeakMap-compatible API (set, get, has, delete) with configurable capacity limits and a victim cache for fast LRU eviction. Unlike plain objects or Map, it avoids collisions with built-in properties like 'constructor' and ensures predictable memory usage. Released on npm with a stable API, it is suitable for caching scenarios where string keys are used and memory constraints exist. It offers a 'hard' mode (default) that strictly evicts oldest entries, and a 'soft' mode that preserves recently set values.
Resources
packagestring-cache-map ↗