CacheManager is an open source caching abstraction layer for .NET written in C#. It supports various cache providers and implements many advanced features.
I m trying to implement multilevel cache with Memcache and Redis in distributed environment.
However, there is a use case where I am facing problem with cache syncing.
Assume the setup as below
1 Redis Instance
2 Servers with multilevel caching (S1-S2) with memcache (M1-M2)
2 Users sending request to the servers (U1-U2)
(Please find attached diagram as text visualization is getting distorted.)
When U1 gets key from redis it is getting stored in M1 cache.
and if same is modified by U2 by requesting S2, M1 still holds the old value.
At any point before expiration if U1 tries to get data from S1 it always receives old value as the M1 is not updated only M2 and Redis are upto date.
Is there any way to sync the M1 with latest values of redis ????
My multilevel cachehandler registration is like this :
var multiplexer = ConnectionMultiplexer.Connect("localhost:6380");
s => s
.WithJsonSerializer()
.WithDictionaryHandle()
.WithExpiration(ExpirationMode.Absolute, TimeSpan.FromSeconds(6000))
.And
.WithRedisConfiguration("redis", multiplexer)
.WithRedisCacheHandle("redis"));
Hi,
I m trying to implement multilevel cache with Memcache and Redis in distributed environment. However, there is a use case where I am facing problem with cache syncing.
Assume the setup as below 1 Redis Instance 2 Servers with multilevel caching (S1-S2) with memcache (M1-M2) 2 Users sending request to the servers (U1-U2)
(Please find attached diagram as text visualization is getting distorted.)
When U1 gets key from redis it is getting stored in M1 cache. and if same is modified by U2 by requesting S2, M1 still holds the old value. At any point before expiration if U1 tries to get data from S1 it always receives old value as the M1 is not updated only M2 and Redis are upto date.
Is there any way to sync the M1 with latest values of redis ????
My multilevel cachehandler registration is like this :
var multiplexer = ConnectionMultiplexer.Connect("localhost:6380");
s => s .WithJsonSerializer() .WithDictionaryHandle() .WithExpiration(ExpirationMode.Absolute, TimeSpan.FromSeconds(6000)) .And .WithRedisConfiguration("redis", multiplexer) .WithRedisCacheHandle("redis"));
Please suggest if I am doing anything wrong......