Browse Source

Extract GetHttpContextItemsCacheKey helper method

pull/24990/head
maliming 5 months ago
parent
commit
b59fc27c1d
No known key found for this signature in database GPG Key ID: A646B9CB645ECEA4
  1. 8
      framework/src/Volo.Abp.AspNetCore.Mvc.Client/Volo/Abp/AspNetCore/Mvc/Client/MvcCachedApplicationConfigurationClient.cs

8
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);
}
}

Loading…
Cancel
Save