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
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
5 additions and
6 deletions
-
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 System.Threading.Tasks; |
|
|
|
using Microsoft.Extensions.Caching.Distributed; |
|
|
|
@ -45,9 +45,8 @@ public class MvcCachedApplicationConfigurationClient : ICachedApplicationConfigu |
|
|
|
var cacheKey = CreateCacheKey(); |
|
|
|
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; |
|
|
|
} |
|
|
|
|
|
|
|
@ -58,10 +57,10 @@ public class MvcCachedApplicationConfigurationClient : ICachedApplicationConfigu |
|
|
|
() => new DistributedCacheEntryOptions |
|
|
|
{ |
|
|
|
AbsoluteExpirationRelativeToNow = TimeSpan.FromSeconds(300) //TODO: Should be configurable.
|
|
|
|
} |
|
|
|
} |
|
|
|
); |
|
|
|
|
|
|
|
if (httpContext != null && !httpContext.WebSockets.IsWebSocketRequest) |
|
|
|
if (httpContext != null) |
|
|
|
{ |
|
|
|
httpContext.Items[cacheKey] = configuration; |
|
|
|
} |
|
|
|
@ -74,7 +73,7 @@ public class MvcCachedApplicationConfigurationClient : ICachedApplicationConfigu |
|
|
|
var cacheKey = CreateCacheKey(); |
|
|
|
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; |
|
|
|
} |
|
|
|
|