MemoryCacheElement.PhysicalMemoryLimitPercentage MemoryCacheElement.PhysicalMemoryLimitPercentage MemoryCacheElement.PhysicalMemoryLimitPercentage MemoryCacheElement.PhysicalMemoryLimitPercentage Property

定义

获取或设置缓存可使用的服务器内存的百分比。Gets or sets the percentage of server memory that can be used by the cache.

public:
 property int PhysicalMemoryLimitPercentage { int get(); void set(int value); };
[System.Configuration.ConfigurationProperty("physicalMemoryLimitPercentage", DefaultValue=Mono.Cecil.CustomAttributeArgument)]
[System.Configuration.IntegerValidator(MaxValue=100, MinValue=0)]
public int PhysicalMemoryLimitPercentage { get; set; }
member this.PhysicalMemoryLimitPercentage : int with get, set
Public Property PhysicalMemoryLimitPercentage As Integer

属性值

缓存可使用的物理内存的百分比(用一个介于 1 到 100 之间的整数值表示)。The percentage of physical memory that the cache can use, expressed as an integer value from 1 to 100. 默认值为零,指示 MemoryCache 实例会基于计算机上安装的内存量来管理自己的内存。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.

注解

如果缓存大小超过指定的限制,内存缓存实现中移除缓存项。If the cache size exceeds the specified limit, the memory cache implementation removes cache entries.

设置PhysicalMemoryLimit属性可以从读取physicalMemoryLimitPercentage的应用程序配置文件中的配置属性。The setting for the PhysicalMemoryLimit property can be read from physicalMemoryLimitPercentage configuration attribute in the application configuration file. 或者,可以将值传递时MemoryCache初始化类。Alternatively, the value can be passed when the MemoryCache class is initialized.

有关如何配置缓存的详细信息,请参阅 <namedCaches>元素 (缓存设置)For more information about how to configure the cache, see <namedCaches> Element (Cache Settings).

适用于

另请参阅