Default ASP.NET use in memory cache so it looks like it use Dictionary<> internally to use key-value pairs. But external caching solutions like Azure cache or others serialize data which makes scenarious different that in memory solution. At below example, i hold List object with key and i update it.
var users = new List<User>();
HttpContext.Cache.Insert("key", users);
users.Add(new User());//cached list will update itself with this insertion ?
var cachedUsers = (List<User>) HttpContext.Cache["key"];// now i got users list object reference or copied users list without inserted user ?
As i commented on lines, if this scenario use default in memory cache solution of ASP.NET so it is clear that cache holds users list reference but answers are changing if i use external Cache solution like Azure cache solution. What are answers of below questions if external solution is used which serialize objects instead of caching object references ?
Cached list will update itself with that insertion ?
if i get back data from cache,it would be users list object reference or copied users list without inserted user ?