Return previously cached result if promise fails
joanned opened this issue · comments
I have a request to have the option to return the previously cached result if the promise fails. This is a fairly common use case for when an API call fails and we want to return the previously available data.
How are you using mem
? The whole point of it is to return the previously-cached result already. After the first call, successive calls won’t trigger an API request.
@fregante after the cache expires and we call the API again, if that new call fails, I'd like to use the previously cached item.
Expired items are completely wiped by https://www.npmjs.com/package/map-age-cleaner
What you’re asking isn’t possible without a complete rewrite