Can MultiCacheCliet be used as a fallback mechanism

We use Redis as our cache but some infrastructure issues have made our Redis server crash occasionally. When it does, our site goes down.

Could we configure MultiCacheclient with Redis and MemoryCache, and use the latter only in the event the former goes down?

Kind of, here’s the implementation of MultiCacheClient.cs

Which works like a “write through multi-tiered cache” where all “writes” are made to all registered cache providers whilst “reads” are only accessed until a value exists.

services.AddSingleton<ICacheClient>(c => new MultiCacheClient(
    new MemoryCacheClient(),
    c.GetRequiredService<IRedisClientsManager>().GetCacheClient()));

So whilst it will make writes to both providers it’ll only retrieve the value from the first MemoryCacheClient provider which has the value. You may still not have a great experience if the redis server is hanging clients as writes would need to wait until timeout elapsed, but if the redis server was completely offline the calls to redis should fail immediately which would be preferred.