diff --git a/xml/System.Runtime.Caching/MemoryCache.xml b/xml/System.Runtime.Caching/MemoryCache.xml index 9d94f787f82..c15be27505a 100644 --- a/xml/System.Runtime.Caching/MemoryCache.xml +++ b/xml/System.Runtime.Caching/MemoryCache.xml @@ -425,13 +425,14 @@ private void btnGet_Click(object sender, EventArgs e) property, the cache implementation removes cache entries. Each cache instance in the application can use the amount of memory that is specified by the property. +> [!IMPORTANT] +> In .NET Core and .NET 5.0 and later, the property does not have any effect. The underlying implementation for enforcing this limit is not functional outside of .NET Framework. - The settings for the property can be specified in the application configuration file. Alternatively, they can be passed in the constructor when the class is initialized. For more information about how to configure this property, see [<namedCaches> Element (Cache Settings)](/dotnet/framework/configure-apps/file-schema/runtime/namedcaches-element-cache-settings). For more information about how to set this value when the class is being initialized, see the method. +In .NET Framework (4.x), if the current instance of the cache exceeds the limit on memory set by the property, the cache implementation removes cache entries. Each cache instance in the application can use the amount of memory that is specified by the property. In .NET Core and later, this property returns the value from configuration or constructor parameters but is not enforced. - does not instantly enforce each time a new item is added to a instance. The internal heuristics which evicts extra items from the does it gradually and takes into account information from the garbage collector (see [Garbage Collection](/dotnet/standard/garbage-collection/)) and other factors such as current cache size and overall system memory pressure. Therefore even though the tries to keep the cache size within the configured it is possible to temporarily exceed the limit by adding cache items at a very high rate. +You can specify the settings for the property in the application configuration file. Alternatively, they can be passed in the constructor or by a caller when the instance is initialized. - ]]> + ]]> <namedCaches> Element (Cache Settings) @@ -928,15 +929,15 @@ private void btnGet_Click(object sender, EventArgs e) System.Int64 - Gets the percentage of physical memory that the cache can use. - The percentage of physical memory that the cache can use. + Gets the percentage of total system physical memory usage at which the cache will begin evicting entries. + The percentage of overall physical memory usage on the system that triggers cache eviction. property returns the percentage of total physical computer memory that can be used by a single instance of the class. If the cache instance exceeds the specified limit, cache entries are removed. + The property specifies the percentage of total physical memory usage on the system (by all processes) at which the cache will begin to evict entries. This setting is not a limit on the memory that a single instance can use. Instead, when overall system physical memory usage exceeds this percentage, the cache proactively removes entries to help reduce memory pressure and avoid exhausting system memory, even if the cache itself is not over its other size limits. - The settings for the property can be specified in the application configuration file. Alternatively, they can be passed by a caller when the class is initialized. For more information about how to configure this property, see [<namedCaches> Element (Cache Settings)](/dotnet/framework/configure-apps/file-schema/runtime/namedcaches-element-cache-settings). For more information about how to configure the property when the class is being initialized, see the method. + You can specify the settings for the property in the application configuration file. Alternatively, they can be passed by a caller when the instance is initialized. ]]>