<system.runtime.caching> Element (Cache Settings)

Provides configuration for the default in-memory ObjectCache implementation through the memoryCache entry in the configuration file.



<system.runtime.caching >  
   <!-- child elements -->  
</system.runtime.caching >  

Attributes and Elements

The following sections describe attributes, child elements, and parent elements.



Child Elements

Element Description
<memoryCache> Defines an element that is used to configure a cache that is based on the MemoryCache class.

Parent Elements

Element Description
<configuration> Specifies the root element in every configuration file that is used by the common language runtime and .NET Framework applications.


The classes in this namespace provide a way to use caching facilities like those in ASP.NET, but without a dependency on the System.Web assembly. For more information, see Caching in .NET Framework Applications.


The output caching functionality and types in the System.Runtime.Caching namespace are new in .NET Framework 4.


The following example shows how to configure a cache that is based on the MemoryCache class. The example shows how to configure an instance of the namedCaches entry for memory cache. The name of the cache is set to the default cache entry name by setting the name attribute to "Default".

The cacheMemoryLimitMegabytes attribute and the physicalMemoryPercentage attribute are set to zero. Setting these attributes to zero means that the MemoryCache autosizing heuristics are used by default. The cache implementation should compare the current memory load against the absolute and percentage-based memory limits every two minutes.

          <add name="Default"
               pollingInterval="00:02:00" />  

See also