connor4312 / cockatiel

🐦 A resilience and fault-handling library. Supports Backoffs, Retries, Circuit Breakers, Timeouts, Bulkhead Isolation, and Fallbacks.
MIT License
1.57k stars 48 forks source link

Any plans to add Caching policy like in Polly? #63

Closed johnib closed 2 years ago

johnib commented 2 years ago

Hi,

Would be happy to get to a feature parity with .NET's Polly library. So far I'm using this library extensively.. and Caching policy is one part that is missing.

Thank you!

moberegger commented 2 years ago

Perhaps the policy could be built on top of (or align to) keyv. Could help get it working "out of the box" with other tools. By default, it would cache in memory, but there are adaptors for things like Redis available.

connor4312 commented 2 years ago

Yea, I think this is probably out of scope at first glance, but would need to look into Polly more. Notably .NET has an official IDistributedCache interface so that any cache that implements it can work automatically with Polly. JavaScript does not have an equivalent.

It'd be easy for a caching library to consume Cockatiel by taking policies in its operations, or wrap a caching library to that effect.

connor4312 commented 2 years ago

I don't have any plans here.