StackExchange / StackExchange.Redis

General purpose redis client
https://stackexchange.github.io/StackExchange.Redis/
Other
5.89k stars 1.51k forks source link

Supporting Write Through and Read Through caching strategy #2504

Closed mehdihadeli closed 1 year ago

mehdihadeli commented 1 year ago

Hi, Is there any plan for handling Write Through and Read Through caching strategy in this library, like something exists in redisson/redisson java library?

NickCraver commented 1 year ago

Not in this library most likely, this is purely a client with some handling almost 1:1 with what Redis allows. But this is being discussed, and we may end up adding some extensibility points to support that (especially around efficiency in later .NET versions taking advantage of goodies.

"How do I (de)serialize my object?" is a surprisingly deep question to get right, and varies a lot across languages/platforms. We want to solve it well for .NET when doing this.

cc @mgravell

mgravell commented 1 year ago

Indeed; this is a focus of mine for .NET 9 in the context of asp.net - see https://devblogs.microsoft.com/dotnet/caching-abstraction-improvements-in-aspnetcore/ for some preview discussion on that topic. As Nick notes, serialization is a significant hurdle re configuration, but: I have ideas. And as discussed in #2507, we'd also be looking to implement things like server-assisted evictions at the same time.

mehdihadeli commented 1 year ago

Thanks for your information, Does it make sense to create this type of caching strategy (Write Through or Read Through) in a building block project or an azure function, and our application just use it without handling updating primary database manually? I just want to decrease duplicate codes in my application for syncing between Redis and primary database.

mgravell commented 1 year ago

Whether it makes sense or not is hugely contextual. "Maybe"

mehdihadeli commented 1 year ago

Yes, Thanks

NickCraver commented 1 year ago

Since we'll have many issues on this - closing out as the question here's answered.