From ed0bedec8342973b3d83099f818750db6677af0d Mon Sep 17 00:00:00 2001 From: pedrobsaila Date: Sun, 19 May 2024 15:18:05 +0200 Subject: [PATCH 1/3] 2nd call to MemoryCache.Set() with the same key erases entry if cache is full --- .../MemoryCacheOptions.xml | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/xml/Microsoft.Extensions.Caching.Memory/MemoryCacheOptions.xml b/xml/Microsoft.Extensions.Caching.Memory/MemoryCacheOptions.xml index 49f21066301..ea245454930 100644 --- a/xml/Microsoft.Extensions.Caching.Memory/MemoryCacheOptions.xml +++ b/xml/Microsoft.Extensions.Caching.Memory/MemoryCacheOptions.xml @@ -210,9 +210,11 @@ Gets or sets the maximum size of the cache. To be added. - [!CAUTION] -> There may be transient states while the cache is full but blocks are being released on a background thread. In this state, unexpected behavior might occur if the cache is being overutilized. + [!CAUTION] +> There may be transient states while the cache is full but blocks are being released on a background thread. In this state, unexpected behavior might occur if the cache is being overutilized. +> +> When making a call to to update an existing item that will make cache size go beyond the size limit, the existing and new items will be instead removed. ]]> @@ -238,12 +240,12 @@ if linked entries are tracked; otherwise, . The default is in .NET 7 and later versions. - From 60f05afae2a8cf11a548b56fbb3d2440e852fa56 Mon Sep 17 00:00:00 2001 From: pedrobsaila Date: Sun, 19 May 2024 15:59:27 +0200 Subject: [PATCH 2/3] fix warning --- xml/Microsoft.Extensions.Caching.Memory/MemoryCacheOptions.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xml/Microsoft.Extensions.Caching.Memory/MemoryCacheOptions.xml b/xml/Microsoft.Extensions.Caching.Memory/MemoryCacheOptions.xml index ea245454930..15e183f420b 100644 --- a/xml/Microsoft.Extensions.Caching.Memory/MemoryCacheOptions.xml +++ b/xml/Microsoft.Extensions.Caching.Memory/MemoryCacheOptions.xml @@ -214,7 +214,7 @@ > [!CAUTION] > There may be transient states while the cache is full but blocks are being released on a background thread. In this state, unexpected behavior might occur if the cache is being overutilized. > -> When making a call to to update an existing item that will make cache size go beyond the size limit, the existing and new items will be instead removed. +> When updating an existing item with another one that will make cache size go beyond the limit, the existing and new items will be removed. ]]> From 27a2065fec6e6df1c069b5a1fc029de8b6e34a0f Mon Sep 17 00:00:00 2001 From: pedrobsaila Date: Sat, 15 Jun 2024 14:46:13 +0200 Subject: [PATCH 3/3] fix remarks 1 --- xml/Microsoft.Extensions.Caching.Memory/MemoryCacheOptions.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xml/Microsoft.Extensions.Caching.Memory/MemoryCacheOptions.xml b/xml/Microsoft.Extensions.Caching.Memory/MemoryCacheOptions.xml index 15e183f420b..3c5df374694 100644 --- a/xml/Microsoft.Extensions.Caching.Memory/MemoryCacheOptions.xml +++ b/xml/Microsoft.Extensions.Caching.Memory/MemoryCacheOptions.xml @@ -214,7 +214,7 @@ > [!CAUTION] > There may be transient states while the cache is full but blocks are being released on a background thread. In this state, unexpected behavior might occur if the cache is being overutilized. > -> When updating an existing item with another one that will make cache size go beyond the limit, the existing and new items will be removed. +> When making a call to replace an existing item with another one that will make cache size go beyond the limit, the existing and new items will be removed. ]]>