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.33k stars 456 forks source link

Is it possible to do cache eviction when backplane is down #338

Open jasonp123 opened 3 years ago

jasonp123 commented 3 years ago

We have multiple services with an in-memory cache backed by a redis backplane. This is also a read through cache, so if nothing is found in in-memory or redis, then it will call an endpoint to get the information (and then put in cache).

If Redis goes down, there is potential for the individual services to perform work on stale information because the source could modify the data, but the backplane wouldnt notify because it would be down. So I was wondering if cache manager can evict when a backplane is unavailable (so our services would end up calling the readthrough)

MichaCo commented 3 years ago

No that's not build in. I'm also not sure it ever will be because everyone might have different use cases for that. For example, I might be actually fine with having stale data for a while and can wait for Redis to come back online.

But I guess you could implement that yourself by checking if Redis is up from time to time and then clear the cache locally?