A two-tier cache library with a fixed-capacity first-level (memory-resident) cache and an LRU second-level cache. Version 2.1.1 is current, stable, and ships TypeScript definitions. Differentiators include configurable expiration, weight-based eviction, and event hooks (before_add, add, update, del). It is lightweight with no external dependencies, suitable for Node.js or browser environments.
npm install secondary-cacheNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Demonstrates basic usage of Cache with fixed and LRU tiers, expiration, events, and deletion.
Ensure capacity > 0 to enable secondary LRU caching.
Multiply seconds by 1000 when providing expiration time.
Provide cleanInterval in seconds (e.g., 60 for 1 minute).
Use cache.has(id) instead.
Attach event listeners before any cache.set() calls.
Update config objects: { fixedCapacity: N, capacity: M }.Cache instances extend EventEmitter; ensure you are using the correct import and the version supports events.
Adjust maxWeight or override weightOf function to assign appropriate weights.
Use import { Cache } from 'secondary-cache' and instantiate with 'new Cache()'.Set cleanInterval to a positive integer (in seconds) to enable background cleanup, or omit if not needed.
No dependency data recorded yet.