Cache.Insert wierd behavior

  • Thread starter Thread starter Alvin Bruney
  • Start date Start date
A

Alvin Bruney

application_start
onRemove = new CacheItemRemovedCallback(this.onRemoveReload);
HttpContext.Current.Cache.Insert("CUSTOMERLIST", ds, null,
DateTime.Now.AddSeconds(5), Cache.NoSlidingExpiration,
CacheItemPriority.Normal, onRemove);

onremovereload
//onRemove = new CacheItemRemovedCallback(this.onRemoveReload);
DataSet ds =
GlobalRateMan.GetOdessiDataSet(GlobalRateMan.sqlCustomerMastEx);
HttpContext.Current.Cache.Insert("CUSTOMERLIST", ds, null,
DateTime.Now.AddSeconds(5), Cache.NoSlidingExpiration,
CacheItemPriority.Normal, onRemove);

What i am expecting is every 5 seconds for the cache object to be
invalidated firing the delegate. This isn't happening. it fires once or
twice and then no more. How is this supposed to work?

It suddenly hit me that the framework might be using the cache invalidation
directive as a recommendation. Is that it? Meaning it doesn't have to act on
it except when the cache object is accessed. Or should it be expelled every
5 seconds regardless. In that case, it isn't working.
 
Back
Top