MichaCo / CacheManager

CacheManager is an open source caching abstraction layer for .NET written in C#. It supports various cache providers and implements many advanced features.
http://cachemanager.michaco.net
Apache License 2.0
2.34k stars 457 forks source link

Query : What if Redis is down and Put in in-memory is done but not in Redis #247

Closed shah-keyur closed 5 years ago

shah-keyur commented 6 years ago

Hi MichaCo,

What happens when Redis is down and trying to do put operation when in-memory is configured with Redis.

I guess in-memory will have the latest value for a key but Redis will not, right?

Is there a way we can just make the in-memory read-only?

var cache = CacheFactory.Build(settings => { settings .WithMemoryCacheHandle().And .WithRedisConfiguration("redis", "localhost:6379,allowAdmin=true") .WithRedisCacheHandle("redis"); });

Thanks, Keyur

MichaCo commented 5 years ago

No, there is no such thing of making a layer readonly or even allow the cache overall to continue to work when Redis is used but not available. You'll simply get exceptions and have to deal with that in your application logic. Same as if you'd use a Redis client only.

I know, it would be great if all that complexity would be handled by CacheManager. Long story short, there is simply no easy way to achieve that and therefor, I'm not even trying to ;)