A simple retry wrapper for StackExchange.Redis
RedisRetry is a library that you can add to your project that will extend your IDatabase
interface.
It provides retry functionality (using Polly) for common Redis commands.
Each application needs to decide what operations can be retried and which cannot. See https://gist.github.com/JonCole/925630df72be1351b21440625ff2671f#when-is-it-safe-to-retry for a more in-depth answer.
For most applications idempotent operations should be safe to retry. For example HashGetAsync
or KeyExpireAsync
are idempotent while HashIncrementAsync
is not.