I have this code
Microsoft.ApplicationServer.Caching.DataCache cache;
...
User user = (User)cache["cacheKey"];
user.Name = "NewUserName";
Will cached User object be automatically updated? Or I need to call clearing cache and put new value into the cache.
Will it be applied on all web roles, or maybe I am doing something wrong. I need to be able to edit cached object and this changes should be applied for both azure web roles
After looking here and here on MSDN, I believe
userwill be a deserialization of the cached object, effectively your local clone.So no, you will not be updating the actual cached object. Once you have made you changes you will have to update the cached object. Using either,
or