将Azure Redis缓存拆分为主缓存和辅助缓存

编程入门 行业动态 更新时间:2024-10-05 05:21:28
本文介绍了将Azure Redis缓存拆分为主缓存和辅助缓存的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

团队,

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缓存拆分为主缓存和辅助缓存

本文发布于:2023-11-26 18:57:02,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1634786.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:缓存   Azure   Redis

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!