LRU cache for Node.js cluster mode (v2.1.0). Eliminates per-worker cache duplication by hosting a single lru-cache instance in the primary process and exposing it to workers over cluster IPC. Supports atomic counters, single-flight fetches, optional L1 hot caches, and pluggable codecs. Requires Node >=22 and lru-cache ^11. Compared to standalone lru-cache, this package provides cluster-wide consistency and memory savings without external dependencies like Redis.
npm install lru-cache-for-clusters-as-promisedNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows how to create a clustered LRU cache in the primary and use it from a worker. Both primary and worker must call ready() before use.
Upgrade Node to >=22 or use an older version of the package (v1.x may support older Node).
Install lru-cache@^11 alongside this package.
Upgrade to v2 and update imports accordingly.
Always await cache.ready() after constructing the cache instance.
Use import syntax or dynamic import().
Use distinct namespace strings for different cache instances.
Change require() to import or use dynamic import().
Ensure cache is created with new LRUCacheClustered() and wait for ready().
Use unique namespace strings for each cache instance.
Run npm install @0xdoublesharp/lru-cache-clustered lru-cache.