Splitting Azure Redis Cache into Primary and secondary cache

試著忘記壹切 提交于 2020-01-16 16:13:58

问题


Team,

Beginner in Azure. I am running a Azure web app referencing a azure redis cache. Now i have a requirement whereby i have to load the colleagues data into the primary cache upon the first load and any updates to the colleagues count is loaded in the secondary cache. Once completed a swap is done where by the change in the value of the primary key value.

So i have implemented in such a way that it will first identify which is primary and which is secondary. ( Please note that i am not sure if this approach is correct or not). I have introduced a primary key value for that matter. So i use the code below

try 
{ 
    IServer server = cacheFactory.GetServer(getEndPoint(), null); //TODO read from config 
    var StoreCache = cacheFactory.GetDatabase(0, null); 
    StoreCache.StringSet("PrimaryCacheKey",cache.Name); //Set the primary cache key to be whatever this cache is 
} 
catch (Exception ex) 
{ 
    this.Logger.Error(ex, "Error setting primary cache."); 
    throw; 
} 

But this throws an error saying "Object not set to reference of the object). When i debug the value of the cache.Name= 1. Why does it not find the cache.Name when i am trying to set the key for this.

Any other suggestions welcome please.


回答1:


Actually, it sounds like exactly the issue which is already tracked in the StackExchange.Redis repository. So, I suggest that you could update your nuget version and restart it.

For more details, you could refer to this similar issue.



来源:https://stackoverflow.com/questions/54697288/splitting-azure-redis-cache-into-primary-and-secondary-cache

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!