团队,
Azure的入门者.我正在运行引用Azure Redis缓存的Azure Web应用程序.现在,我有一个要求,我必须在第一次加载时将同事数据加载到主缓存中,并且对同事计数的任何更新都将加载到辅助缓存中.完成交换后,将通过更改主键值的值来进行交换.
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; }但是这会引发错误消息对象未设置为对象的引用.)当我调试cache.Name = 1的值时,为什么在我尝试设置键时找不到cache.Name为此.
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.
欢迎其他任何建议.
推荐答案实际上,这听起来确实像是已经在StackExchange.Redis存储库中跟踪的问题.因此,我建议您可以更新nuget版本并重新启动它.
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.
更多推荐
将Azure Redis缓存拆分为主缓存和辅助缓存
发布评论