MemoryCacheElement.CacheMemoryLimitMegabytes 属性

定义

获取或设置 MemoryCache 对象的实例可增长到的最大内存大小(以兆字节为单位)。

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

属性值

Int32

最大内存量(以兆字节为单位)。 默认值为零,指示 MemoryCache 实例会基于计算机上安装的内存量来管理自己的内存。

属性

注解

属性值 CacheMemoryLimitMegabytes 表示 cacheMemoryLimitMegabytes 配置元素中的 namedCaches 配置属性。

如果缓存大小超过指定的限制,则内存缓存实现将删除缓存条目。

可以在元素中 namedCaches 单独设置此属性,每个 namedCaches 元素对应于唯一缓存配置。

可以从配置文件中的配置属性读取cacheMemoryLimitMegabytes属性的设置CacheMemoryLimit。 或者,初始化类时 MemoryCache 可以传递设置。

有关如何配置缓存的详细信息,请参阅 <namedCaches> 元素 (缓存设置)

适用于

另请参阅