Strongly-Typed Redis Caching in ASP.NET Core (Without the Boilerplate) (opens in new tab)
If you've added Redis to an ASP.NET Core app, you've probably met IDistributedCache. It does the job, but it only speaks in byte[] and string keys. So every read or write turns into the same little ritual: serialize, null-check, deserialize. Do that in one place and it's fine. Do it in twenty, and you've got a pile of nearly identical caching code that's surprisingly easy to get wrong. This post keeps Redis as your store but caches typed objects instead of byte arrays, using a small open-sour...
Read the original article