jaredwray/cacheable

Cache error fallback (ters)

slukes opened this issue · 4 comments

Describe the bug

Following #588 and #51

It still appears to be the case that if redis is down, we get an error rather than the wrapped function being called.

Could we get some feedback on this please?

Would be happy to invest 1/2 a day to a day to help if you could give any guidance on how you imagined fixing this.

Thanks!

@slukes - thanks for reporting this. It looks like there has been little effort around this on handling it. I think that for right now we dont plan to fix this but if you want to come up with a solution we would love to look at it. Are you thinking that this would be an event that is fired when redis is down?

Going to close this out and if you want to create an enhancement go ahead and do a pull request.

Hello @jaredwray what I was imagining would be to:

  • add config argument of ignoreCacheErrors either to the method wrap or to caching
  • in the method wrap, surround both set and get methods in a try catch
  • in the catch, emit an event and just call the wrapped function

WDYT?

@slukes - would we want to just do the try...catch and do an event emit with error on it to keep it non invasive and simple?

Let's move this discussion to a PR 😄