Hi,
I have a large dataset that I keep cached, however I have occasion to update that cache item from time to time.
Currently we use something like the following:
DSDiaryTableAdapters.tEventsTableAdapter dta = new DSDiaryTableAdapters.tEventsTableAdapter();
dTab = dta.GetData();
//update cache
HttpContext.Current.Cache.Add("FULLEVENTS_MYSQL",
dTab, null, DateTime.Now.AddMinutes(30),System.Web.Caching.Cache.NoSlidingExpiration,
System.Web.Caching.CacheItemPriority.Normal, null);
This method updates the item in the cache on 3 development machines, (XP, and Vista) but on our server (2K3) it does not, the code executes without error but the item in the cache is still the previous (pre updated) item.
If we add the line
HttpContext.Current.Cache.Remove("FULLEVENTS_MYSQL");
before the Cache.Add then the update works.
I was just wondering if anyone could enlighten me as to why this is required on the server but not on the dev machines.
Under what conditions does Cache.Add not replace an item under the same key?
Thanks