Handling Caching Errors with `cachedWithTTL` in Effect Typescript

Hi 👋

Is there any recommendation on how to avoid caching errors when using https://effect.website/docs/caching/caching-effects/#cachedwithttl ?
In the example, imagine expensiveTask returns an error on the first call. I want it to be executed again on the next calls, even if we're within the ttl.

The only way I can think about is to use cachedInvalidateWithTTL and somehow handle a potential error by calling the invalidate function. But that does not feel clean.

Thank you
Effect Documentation
Efficiently manage caching and memoization of effects with reusable tools.
Caching Effects
Was this page helpful?