I am wondering what the benefits of Redis with its C# client over Dictionary/ConcurrentDictionary and otherwise.
I am not sure when using redis is considered overkill for a dictionary storage.
Thanks.
Redis is probably an overkill for a local, one-machine app. Especially when the data is not large.
It's mainly used as an L2 cache layer. Say you've got multiple machines serving your app, each machine can hold its own local cache and Redis can serve as a global cache for all of them.
Let's say a user of your app browses to a page or feature that requires some data from your back end database. Your app will then check its local L1 cache (Dictionary for example). That would be the fastest method as it does not involve any network roundtrip. If the data is not there, it will look for it in Redis as the global app cache. If it's there - great - fetch the data and put in in your local L1 cache. If not, go to the database, fetch the data, put it in Redis (L2) and in your local cache (L1).
You can read more on that here.
That said, there are more usages for Redis other than mere cache - Pub/Sub functionality, SET
s, SORTED SET
s and functionalities on them (like intersections, unions etc.) and even smart functionalities on STRING
types, such as bitwise operations.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With