Browse Source

Merge pull request #11009 from abpframework/auto-merge/rel-5-0/730

Merge branch dev with rel-5.0
pull/11019/head
maliming 5 years ago
committed by GitHub
parent
commit
47ecb2c649
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 11
      framework/src/Volo.Abp.AspNetCore.Mvc.Client/Volo/Abp/AspNetCore/Mvc/Client/MvcCachedApplicationConfigurationClient.cs

11
framework/src/Volo.Abp.AspNetCore.Mvc.Client/Volo/Abp/AspNetCore/Mvc/Client/MvcCachedApplicationConfigurationClient.cs

@ -1,4 +1,4 @@
using System; using System;
using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http;
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.Extensions.Caching.Distributed; using Microsoft.Extensions.Caching.Distributed;
@ -45,9 +45,8 @@ public class MvcCachedApplicationConfigurationClient : ICachedApplicationConfigu
var cacheKey = CreateCacheKey(); var cacheKey = CreateCacheKey();
var httpContext = HttpContextAccessor?.HttpContext; var httpContext = HttpContextAccessor?.HttpContext;
if (httpContext != null && !httpContext.WebSockets.IsWebSocketRequest && httpContext.Items[cacheKey] is ApplicationConfigurationDto configuration) if (httpContext != null && httpContext.Items[cacheKey] is ApplicationConfigurationDto configuration)
{ {
return configuration; return configuration;
} }
@ -58,10 +57,10 @@ public class MvcCachedApplicationConfigurationClient : ICachedApplicationConfigu
() => new DistributedCacheEntryOptions () => new DistributedCacheEntryOptions
{ {
AbsoluteExpirationRelativeToNow = TimeSpan.FromSeconds(300) //TODO: Should be configurable. AbsoluteExpirationRelativeToNow = TimeSpan.FromSeconds(300) //TODO: Should be configurable.
} }
); );
if (httpContext != null && !httpContext.WebSockets.IsWebSocketRequest) if (httpContext != null)
{ {
httpContext.Items[cacheKey] = configuration; httpContext.Items[cacheKey] = configuration;
} }
@ -74,7 +73,7 @@ public class MvcCachedApplicationConfigurationClient : ICachedApplicationConfigu
var cacheKey = CreateCacheKey(); var cacheKey = CreateCacheKey();
var httpContext = HttpContextAccessor?.HttpContext; var httpContext = HttpContextAccessor?.HttpContext;
if (httpContext != null && !httpContext.WebSockets.IsWebSocketRequest && httpContext.Items[cacheKey] is ApplicationConfigurationDto configuration) if (httpContext != null && httpContext.Items[cacheKey] is ApplicationConfigurationDto configuration)
{ {
return configuration; return configuration;
} }

Loading…
Cancel
Save