ls-cache (version 0.2.3) is a browser library that emulates memcache functions using HTML5 localStorage. It stores key-value pairs with optional expiration times in minutes, automatically evicts expiring entries when the ~5MB limit is approached, and degrades gracefully if localStorage is unavailable. Supports hierarchical buckets for independent caching scopes. Current version is 0.2.3; no recent releases. Differentiates from lscache by adding bucket hierarchies and a non-global namespace.
npm install ls-cacheNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Demonstrates basic set/get with expiration, object storage, removal, flush, and hierarchical buckets.
Consider using a maintained alternative like lscache-ts or implementing your own wrapper.
Avoid storing large objects; keep data small to prevent UI jank.
Always pass minutes. For example, 1 hour = 60.
Set expiration on all entries to allow automatic eviction. Or handle QuotaExceededError manually.
Use flushRecursive to clear a bucket and all its children.
Run npm install ls-cache, then import lscache from 'ls-cache'.
Use import lscache from 'ls-cache' instead of import { lscache } from 'ls-cache'.Reduce stored data size, ensure most entries have expiration times, or call lscache.flush() manually to clear space.
Add <script src='ls-cache.js'></script> or import lscache properly.
No dependency data recorded yet.