Thin wrapper around lru-cache with extended functionality.
Install with npm:
$ npm install --save lru-cache-ext
Please refer to lru-cache.
Some additional, non-invasive functionality is added.
Only when the key is not present in cache (or has expired), valueFn
is called and placed into cache.
The cached value is returned when it becomes available (important in the case where valueFn
is async).
The cache is left empty if an error is thrown at any point in valueFn
.
Useful when multiple async operation need to access the same async information.