<namedCaches> Element (Cache Settings)
Specifies a collection of configuration settings for the named MemoryCache instances. The NamedCaches property references the collection of configuration settings from one or more
namedCaches elements of the configuration file.
<namedCaches> <add name="default"/> </namedCaches>
Attributes and Elements
The following sections describe attributes, child elements, and parent elements.
||An integer value that specifies the maximum allowable size, in megabytes, that an instance of a MemoryCache can grow to. The default value is 0, which means that the autosizing heuristics of the MemoryCache class are used by default.|
||The name of the cache.|
||An integer value between 0 and 100 that specifies the maximum percentage of physically installed computer memory that can be consumed by the cache. The default value is 0, which means that the autosizing heuristics of the MemoryCache class are used by default.|
||A value that indicates the time interval after which the cache implementation compares the current memory load against the absolute and percentage-based memory limits that are set for the cache instance. This value is entered in "HH:MM:SS" format.|
|<add>||Adds a named cache to the
|<remove>||Removes a named cache entry from the
|<configuration>||Specifies the root element in every configuration file that is used by the common language runtime and .NET Framework applications.|
|<memoryCache>||Defines an element that is used to configure a cache that is based on the MemoryCache class.|
|<system.runtime.caching>||Contains types that let you implement output caching in applications that are built into the .NET Framework.|
The memory cache configuration section of the Web.config file can contain
clear attributes for the
namedCaches collection. Each
namedCaches entry is uniquely identified by the
You can retrieve instances of memory cache entries by referencing the information in the application configuration files. By default, only the default cache instance has an entry in the configuration file. The default cache instance is the instance that is returned from the Default property.
If you set the name attribute to "default", the element uses the default memory cache instance.
The following example shows how to set the name of the cache to the default cache entry name by setting the
name attribute to "default".
cacheMemoryLimitMegabytes attribute and the
physicalMemoryPercentage attribute are set to zero. Setting these attributes to zero means that the autosizing heuristics of the MemoryCache class are used. The cache implementation compares the current memory load against the absolute and percentage-based memory limits every two minutes.
<configuration> <system.runtime.caching> <memoryCache> <namedCaches> <add name="default" cacheMemoryLimitMegabytes="0" physicalMemoryLimitPercentage="0" pollingInterval="00:02:00" /> </namedCaches> </memoryCache> </system.runtime.caching> </configuration>