Export (0) Print
Expand All

MemoryCacheElement.CacheMemoryLimitMegabytes Property

Gets or sets the maximum memory size, in megabytes, that an instance of a MemoryCache object can grow to.

Namespace:  System.Runtime.Caching.Configuration
Assembly:  System.Runtime.Caching (in System.Runtime.Caching.dll)

[IntegerValidatorAttribute(MinValue = )]
[ConfigurationPropertyAttribute("cacheMemoryLimitMegabytes", DefaultValue = )]
public int CacheMemoryLimitMegabytes { get; set; }

Property Value

Type: System.Int32
The amount of maximum memory size, in megabytes. The default is zero, which indicates that MemoryCache instances manage their own memory based on the amount of memory that is installed on the computer.

The CacheMemoryLimitMegabytes property value represents the cacheMemoryLimitMegabytes configuration attribute in the namedCaches configuration element.

If the cache size exceeds the specified limit, the memory cache implementation removes cache entries.

This property can be set individually in namedCaches elements, with each namedCaches element corresponding to a unique cache configuration.

The settings for the CacheMemoryLimit property can be read from the cacheMemoryLimitMegabytes configuration attribute in the configuration file. Alternatively, the settings can be passed when the MemoryCache class is initialized.

For more information about how to configure the cache, see <namedCaches> Element (Cache Settings).

.NET Framework

Supported in: 4.5, 4

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Show:
© 2014 Microsoft