Rediger

Del via


MemoryCacheElement.CacheMemoryLimitMegabytes Property

Definition

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

public:
 property int CacheMemoryLimitMegabytes { int get(); void set(int value); };
[System.Configuration.ConfigurationProperty("cacheMemoryLimitMegabytes", DefaultValue=0)]
[System.Configuration.IntegerValidator(MinValue=0)]
public int CacheMemoryLimitMegabytes { get; set; }
[<System.Configuration.ConfigurationProperty("cacheMemoryLimitMegabytes", DefaultValue=0)>]
[<System.Configuration.IntegerValidator(MinValue=0)>]
member this.CacheMemoryLimitMegabytes : int with get, set
Public Property CacheMemoryLimitMegabytes As Integer

Property Value

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.

Attributes

Remarks

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).

Applies to

See also