Caching Application Block : NeverExpire : Enterprise Library 2.0

Topics: Caching Application Block
Nov 15, 2007 at 2:06 PM

I am using Caching Application Block of entlib 2.0 for a web application. My requirement is something like, the Items stored in the cache manager should never expire. I would like to know whether the following piece of XML Configuration and the code would do the trick.

<add name="Environment"
backingStoreName="inMemory" />

I am using the environmentCacheManager.Add(key, value) method to add the items into the cache manager.

Secondly, I am interested in knowing what is the maximum duration a cache can be stored (like 1,2,3 days or will it never expire) ?

Thanks in Advance
Nov 16, 2007 at 1:08 PM

Scavenging is different from expiration.

You can use the full overload for the cache manager's Add method and specify a NeverExpired expiration and a _CacheItemPriority.NotRemovable _ scanvenging priority if you never want the items to go away. But if you don't want items to expire, why do you use a cache instead of a dictionary?

I don't understand your question about the maximum duration.