lru cache but get supports a fill callback
lru-cache where get accepts an optional "fill" callback. A fill callback would be used to populate a value in the background before it is really expired. set also supports ttl per key.
var cache = require'halfexpired-lru';cacheset'a'1;cacheget'a'iferr == 'halfexpired'// stop it from being half expired.cachesetkeyvaluettl;requesturliferr console.log'that flakey api failed again! good thing my value is not completely expired ;)';else cachesetkeyvaluettl;;