Managing CacheItemPolicy properties from your configuration file - is this possible?

As for the System.Runtime.Caching class in .NET 4.0, it seems possible to set a limited number of things in the configuration file:

  • name
  • polling interval
  • amount of memory that this cache can use
  • percentage of memory that must be deleted before the cache is deleted

The following is an example section:

 <system.runtime.caching>
    <memoryCache>
      <namedCaches>
        <add name="NameOfMyCache" pollingInterval="00:05:00" cacheMemoryLimitMegabytes="0" physicalMemoryLimitPercentage="0"/>
      </namedCaches>
    </memoryCache>
  </system.runtime.caching>

However, it seems that none of the really useful elements (IMHO!) Are controlled from the configuration file. These are all parameters in the CacheItemPolicy class, such as AbsoluteExpiration, SlidingExpiration and Priority (I can understand how the callback functions are not displayed, although I would expect to see some options for what to do if they were called)

, , ?

+3

All Articles