diff --git a/BootstrapBlazor.sln b/BootstrapBlazor.sln
index 9180621c8a0..c0db3d47fbb 100644
--- a/BootstrapBlazor.sln
+++ b/BootstrapBlazor.sln
@@ -74,6 +74,10 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "cert", "cert", "{C075C6C8-B
scripts\linux\cert\www.blazor.zone.key = scripts\linux\cert\www.blazor.zone.key
EndProjectSection
EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tools", "tools", "{9BAF50BE-141D-4429-93A9-942F373D1F68}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnitTest.Benchmarks", "tools\Benchmarks\UnitTest.Benchmarks.csproj", "{3E6D8D0E-5A36-4CFD-8612-7D64E3FFE7B1}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -104,6 +108,10 @@ Global
{D8AEAFE7-10AF-4A5B-BC67-FE740A2CA1DF}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D8AEAFE7-10AF-4A5B-BC67-FE740A2CA1DF}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D8AEAFE7-10AF-4A5B-BC67-FE740A2CA1DF}.Release|Any CPU.Build.0 = Release|Any CPU
+ {3E6D8D0E-5A36-4CFD-8612-7D64E3FFE7B1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {3E6D8D0E-5A36-4CFD-8612-7D64E3FFE7B1}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {3E6D8D0E-5A36-4CFD-8612-7D64E3FFE7B1}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {3E6D8D0E-5A36-4CFD-8612-7D64E3FFE7B1}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -119,6 +127,7 @@ Global
{6D73FED6-0086-460B-84FA-1FA78176BF59} = {7C1D79F1-87BC-42C1-BD5A-CDE4044AC1BD}
{D8AEAFE7-10AF-4A5B-BC67-FE740A2CA1DF} = {7C1D79F1-87BC-42C1-BD5A-CDE4044AC1BD}
{C075C6C8-B9CB-4AC0-9BDF-B2002B4AB99C} = {EA765165-0542-41C8-93F2-85787FEDEDFF}
+ {3E6D8D0E-5A36-4CFD-8612-7D64E3FFE7B1} = {9BAF50BE-141D-4429-93A9-942F373D1F68}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {0DCB0756-34FA-4FD0-AE1D-D3F08B5B3A6B}
diff --git a/src/BootstrapBlazor.Server/Components/Pages/CacaheExpiration.razor b/src/BootstrapBlazor.Server/Components/Pages/CacaheExpiration.razor
new file mode 100644
index 00000000000..09f4d4634b3
--- /dev/null
+++ b/src/BootstrapBlazor.Server/Components/Pages/CacaheExpiration.razor
@@ -0,0 +1 @@
+@ExpirationTime
diff --git a/src/BootstrapBlazor.Server/Components/Pages/CacaheExpiration.razor.cs b/src/BootstrapBlazor.Server/Components/Pages/CacaheExpiration.razor.cs
new file mode 100644
index 00000000000..19bf5e463e4
--- /dev/null
+++ b/src/BootstrapBlazor.Server/Components/Pages/CacaheExpiration.razor.cs
@@ -0,0 +1,62 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the Apache 2.0 License
+// See the LICENSE file in the project root for more information.
+// Maintainer: Argo Zhang(argo@live.ca) Website: https://www.blazor.zone
+
+using Microsoft.Extensions.Caching.Memory;
+
+namespace BootstrapBlazor.Server.Components.Pages;
+
+///
+/// CacaheExpiration 组件
+///
+public partial class CacaheExpiration
+{
+ [Inject, NotNull]
+ private ICacheManager? CacheManager { get; set; }
+
+ ///
+ /// 获得/设置 实例
+ ///
+ [Parameter, NotNull]
+ public object? Key { get; set; }
+
+ private string? ExpirationTime { get; set; }
+
+ ///
+ ///
+ ///
+ ///
+ protected override async Task OnParametersSetAsync()
+ {
+ await base.OnParametersSetAsync();
+
+ await GetCacheEntryExpiration();
+ }
+
+ private async Task GetCacheEntryExpiration()
+ {
+ ExpirationTime = "loading ...";
+ await Task.Yield();
+
+ if (CacheManager.TryGetCacheEntry(Key, out ICacheEntry? entry))
+ {
+ if (entry.Priority == CacheItemPriority.NeverRemove)
+ {
+ ExpirationTime = "Never Remove";
+ }
+ else if (entry.SlidingExpiration.HasValue)
+ {
+ ExpirationTime = $"Sliding: {entry.SlidingExpiration.Value}";
+ }
+ else if (entry.AbsoluteExpiration.HasValue)
+ {
+ ExpirationTime = $"Absolute: {entry.AbsoluteExpiration.Value}";
+ }
+ else if (entry.ExpirationTokens.Count != 0)
+ {
+ ExpirationTime = $"Token: {entry.ExpirationTokens.Count}";
+ }
+ }
+ }
+}
diff --git a/src/BootstrapBlazor.Server/Components/Pages/CacheList.razor b/src/BootstrapBlazor.Server/Components/Pages/CacheList.razor
index 1a74b25620d..dc3be3babfb 100644
--- a/src/BootstrapBlazor.Server/Components/Pages/CacheList.razor
+++ b/src/BootstrapBlazor.Server/Components/Pages/CacheList.razor
@@ -18,6 +18,11 @@
@GetValue(v.Row)
+
+
+
+
+
diff --git a/src/BootstrapBlazor.Server/Components/Pages/CacheList.razor.cs b/src/BootstrapBlazor.Server/Components/Pages/CacheList.razor.cs
index f72eabe53f0..317ca3ff084 100644
--- a/src/BootstrapBlazor.Server/Components/Pages/CacheList.razor.cs
+++ b/src/BootstrapBlazor.Server/Components/Pages/CacheList.razor.cs
@@ -49,7 +49,7 @@ private void OnRefresh()
private void UpdateCacheList()
{
- _cacheList = CacheManager.Keys.OrderBy(i => i.ToString()).ToList();
+ _cacheList = [.. CacheManager.Keys.OrderBy(i => i.ToString())];
}
private string GetValue(object key)
diff --git a/src/BootstrapBlazor.Server/Locales/en-US.json b/src/BootstrapBlazor.Server/Locales/en-US.json
index fc9a5053b31..d1adc267964 100644
--- a/src/BootstrapBlazor.Server/Locales/en-US.json
+++ b/src/BootstrapBlazor.Server/Locales/en-US.json
@@ -6910,6 +6910,7 @@
"CacheListIntro": "Manage the component library internal cache through the ICacheManager interface method",
"CacheListKey": "Key",
"CacheListValue": "Value",
+ "CacheListExpiration": "Expiration",
"CacheListAction": "Action",
"CacheListRefresh": "Refresh",
"CacheListDelete": "Delete",
diff --git a/src/BootstrapBlazor.Server/Locales/zh-CN.json b/src/BootstrapBlazor.Server/Locales/zh-CN.json
index 5001b2b456b..136b5dac7f5 100644
--- a/src/BootstrapBlazor.Server/Locales/zh-CN.json
+++ b/src/BootstrapBlazor.Server/Locales/zh-CN.json
@@ -6910,6 +6910,7 @@
"CacheListIntro": "通过 ICacheManager 接口方法管理组件库内部缓存",
"CacheListKey": "键",
"CacheListValue": "值",
+ "CacheListExpiration": "到期时间",
"CacheListAction": "操作",
"CacheListRefresh": "刷新",
"CacheListDelete": "删除",
diff --git a/src/BootstrapBlazor/Services/CacheManager.cs b/src/BootstrapBlazor/Services/CacheManager.cs
index 9e33de0372b..4b7ba4ce2cc 100644
--- a/src/BootstrapBlazor/Services/CacheManager.cs
+++ b/src/BootstrapBlazor/Services/CacheManager.cs
@@ -12,6 +12,7 @@
using System.Reflection;
#if NET8_0_OR_GREATER
+using System.Runtime.CompilerServices;
using System.Collections.Frozen;
#endif
@@ -172,6 +173,53 @@ public IEnumerable