davidjrh/dnn.rediscachingprovider

Cache Coherency Issue

tvatavuk opened this issue · 0 comments

Updating DNN cache in one node do not update DNN cache on other DNN nodes. This issue looks like #6.

We are using DNN Redis Caching Provider v3.1.0 with DNN 9.3.2.

In custom DNN module we can workaround this issue with code like following.

// trash dnn cache in all other nodes
DataCache.RemoveCache(key);

 // set new value
DataCache.SetCache(key, value);

Possible solution is to update RedisCachingProvider code Insert method to broadcast message that will initiate removing of DNN caches in other nodes, after the RedisCache.StringSet(...

// Notify the channel
RedisCache.Publish(new RedisChannel(KeyPrefix + "Redis.Remove", RedisChannel.PatternMode.Auto), $"{InstanceUniqueId}_{key}");

Optionally configuration option can be added to enable/disable this new behavior if affects performance in unexpected way.

If this solution (or better one) is acceptable, I can prepare pull request?

Btw, thanks a lot for RedisCachingProvider. We are using it (with some customization) with out single issue in DNN farm with 14 nodes, for almost 4 years.