Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有这个代码
Microsoft.ApplicationServer.Caching.DataCache cache; ... User user = (User)cache["cacheKey"]; user.Name = "NewUserName";
缓存的用户对象会自动更新吗?或者我需要调用清除缓存并将新值放入缓存中。
它会应用于所有网络角色,还是我做错了什么。我需要能够编辑缓存的对象,并且此更改应适用于两个 azure web 角色
在MSDN上查看here和hereuser之后,我相信将是缓存对象的反序列化,实际上是您的本地克隆。
user
所以不,您不会更新实际的缓存对象。进行更改后,您将必须更新缓存的对象。使用任一,
cache.Put("cacheKey", user);
或者
cache["cacheKey"] = user;