This documentation is archived and is not being maintained.

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

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

<configuration> Element
  <system.runtime.caching> Element (Cache Settings)
<system.runtime.caching >
   <!-- child elements -->
</system.runtime.caching >

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



Child Elements




Defines an element that is used to configure a cache that is based on the MemoryCache class.

Parent Elements




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 version 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" />