in-mem-cache
JavaScript in memory cache that supports reaping
Installation
npm install in-mem-cache --save
Usage
const InMemoryCache = ; const cache = InMemoryCache;const myKey = 'hello'; cache;let value = cache; // 'world'
The cache will emit an event when cache entries are put and deleted if
the emitEntryChanges
option is set;
const cache = InMemoryCache; cache; cache; cache; // triggers the put listenercache; // triggers the delete listener
Alternatively, the option can also be set as an option when values are being set.
const cache = InMemoryCache; cache; cache; cache; // triggers the put listenercache; // triggers the delete listener
Note: Setting the option on the entry will override the default cache option. This allows for finer control over what entries the cache will (or will not) emit events for.