0

From http://msdn.microsoft.com/en-us/library/system.runtime.caching.cacheitempolicy.slidingexpiration(v=vs.110).aspx ...

"A span of time within which a cache entry must be accessed before the cache entry is evicted from the cache. The default is NoSlidingExpiration, meaning that the item should not be expired based on a time span."

What exactly is 'accessed' ? Does that mean if I hit the cached item like:

var object = cache["cachekeyname"];

It's considered to be 'accessed' ?

Or would it only be considered accessed if I actually modify the cached item?

gibbo
  • 367
  • 2
  • 4
  • 15

1 Answers1

3

it does mean that the cache is accessed if the following code is called:

var object = cache["cachekeyname"];

Therefore if the piece of code or functionality containing the above code snippet is not called within X time since you put the object into the cache or it was last accessed it will be removed from the cache.

heads5150
  • 7,263
  • 3
  • 26
  • 34