From b59fc27c1d4ca7c8407046578d310d483d060c2a Mon Sep 17 00:00:00 2001 From: maliming Date: Mon, 2 Mar 2026 14:51:25 +0800 Subject: [PATCH] Extract GetHttpContextItemsCacheKey helper method --- .../Mvc/Client/MvcCachedApplicationConfigurationClient.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.Client/Volo/Abp/AspNetCore/Mvc/Client/MvcCachedApplicationConfigurationClient.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.Client/Volo/Abp/AspNetCore/Mvc/Client/MvcCachedApplicationConfigurationClient.cs index a87a84cf21..c1cc7d52fe 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.Client/Volo/Abp/AspNetCore/Mvc/Client/MvcCachedApplicationConfigurationClient.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.Client/Volo/Abp/AspNetCore/Mvc/Client/MvcCachedApplicationConfigurationClient.cs @@ -47,7 +47,7 @@ public class MvcCachedApplicationConfigurationClient : ICachedApplicationConfigu { string? cacheKey = null; var httpContext = HttpContextAccessor?.HttpContext; - var itemsKey = string.Format(ApplicationConfigurationDtoCacheKeyFormat, CurrentUser.Id?.ToString("N") ?? "Anonymous", CultureInfo.CurrentUICulture.Name); + var itemsKey = GetHttpContextItemsCacheKey(); if (httpContext != null && httpContext.Items[itemsKey] is string key) { cacheKey = key; @@ -109,7 +109,7 @@ public class MvcCachedApplicationConfigurationClient : ICachedApplicationConfigu { string? cacheKey = null; var httpContext = HttpContextAccessor?.HttpContext; - var itemsKey = string.Format(ApplicationConfigurationDtoCacheKeyFormat, CurrentUser.Id?.ToString("N") ?? "Anonymous", CultureInfo.CurrentUICulture.Name); + var itemsKey = GetHttpContextItemsCacheKey(); if (httpContext != null && httpContext.Items[itemsKey] is string key) { cacheKey = key; @@ -137,4 +137,8 @@ public class MvcCachedApplicationConfigurationClient : ICachedApplicationConfigu return await CacheHelper.CreateCacheKeyAsync(CurrentUser.Id); } + protected virtual string GetHttpContextItemsCacheKey() + { + return string.Format(ApplicationConfigurationDtoCacheKeyFormat, CurrentUser.Id?.ToString("N") ?? "Anonymous", CultureInfo.CurrentUICulture.Name); + } }