simple-localstorage-cache
A simple local-storage cache with time based expiration policies
features
- simplicity:
get
,set
, andkeys
with an intuitive, pit-of-success, implementation - interoperability: fulfills the standard SimpleAsyncCache interface
- can be used with
- garbage collection: automatically removes expired keys from local-storage to free up space
install
npm install simple-localstorage-cache
use
create a cache
const cache = createCache({ namespace: 'super-awesome-feature' });
set to the cache
await cache.set('answer', 42);
null
or Infinity
get from the cache
await cache.get('answer'); // 42