A minimal JS cache that prevents unbounded growth by enforcing a size limit and optional max age. Version 2.2.0 actively maintained on GitHub. Provides three API tiers: a standard class-based interface (LimitedCache), a Proxy-based object-style API (LimitedCacheObject), and low-level serializable functions for offline/Redux use. Ships TypeScript definitions. Unlike simple object caches, it uses a circular buffer for efficient eviction and warns in development if items are evicted prematurely.
npm install limited-cacheNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows basic usage of LimitedCache: creation with options, set, get, has, getAll, and reset.
Use useMemo(() => LimitedCache(), []) instead, or copy the hooks from the old source.
Set maxCacheTime to 0 or null only if you want the maximum 1-year expiry. For true unlimited time, set a very large number (but note it's capped at 1 year).
Use for development tuning only; do not rely on it in production.
Prefer LimitedCache or LimitedCacheObject for most use cases; use low-level only when you need serialization (e.g., Redux).
Use LimitedCache instead if Proxy is unavailable.
Change to: import { limitedCacheUtil } from 'limited-cache'Ensure you call LimitedCacheObject() as a function: const cache = LimitedCacheObject();
Run: npm install limited-cache
No dependency data recorded yet.