From ed62b77efdcb2534918d1df192bffee12289e601 Mon Sep 17 00:00:00 2001 From: maliming Date: Mon, 21 Oct 2019 10:07:47 +0800 Subject: [PATCH] Remove unnecessary cacheOption. --- .../Volo/Abp/Caching/DistributedCache.cs | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/framework/src/Volo.Abp.Caching/Volo/Abp/Caching/DistributedCache.cs b/framework/src/Volo.Abp.Caching/Volo/Abp/Caching/DistributedCache.cs index 2a1f109f5c..4140cceeb3 100644 --- a/framework/src/Volo.Abp.Caching/Volo/Abp/Caching/DistributedCache.cs +++ b/framework/src/Volo.Abp.Caching/Volo/Abp/Caching/DistributedCache.cs @@ -19,13 +19,11 @@ namespace Volo.Abp.Caching where TCacheItem : class { public DistributedCache( - IOptions cacheOption, - IOptions distributedCacheOption, + IOptions distributedCacheOption, IDistributedCache cache, ICancellationTokenProvider cancellationTokenProvider, IDistributedCacheSerializer serializer, ICurrentTenant currentTenant) : base( - cacheOption: cacheOption, distributedCacheOption: distributedCacheOption, cache: cache, cancellationTokenProvider: cancellationTokenProvider, @@ -62,12 +60,9 @@ namespace Volo.Abp.Caching protected DistributedCacheEntryOptions DefaultCacheOptions; - private readonly AbpDistributedCacheOptions _cacheOption; - private readonly AbpDistributedCacheOptions _distributedCacheOption; public DistributedCache( - IOptions cacheOption, IOptions distributedCacheOption, IDistributedCache cache, ICancellationTokenProvider cancellationTokenProvider, @@ -75,7 +70,6 @@ namespace Volo.Abp.Caching ICurrentTenant currentTenant) { _distributedCacheOption = distributedCacheOption.Value; - _cacheOption = cacheOption.Value; Cache = cache; CancellationTokenProvider = cancellationTokenProvider; Logger = NullLogger>.Instance; @@ -88,7 +82,7 @@ namespace Volo.Abp.Caching } protected virtual string NormalizeKey(TCacheKey key) { - var normalizedKey = "c:" + CacheName + ",k:" + _cacheOption.KeyPrefix + key.ToString(); + var normalizedKey = "c:" + CacheName + ",k:" + _distributedCacheOption.KeyPrefix + key.ToString(); if (!IgnoreMultiTenancy && CurrentTenant.Id.HasValue) { @@ -100,7 +94,7 @@ namespace Volo.Abp.Caching protected virtual DistributedCacheEntryOptions GetDefaultCacheEntryOptions() { - foreach (var configure in _cacheOption.CacheConfigurators) + foreach (var configure in _distributedCacheOption.CacheConfigurators) { var options = configure.Invoke(CacheName); if (options != null) @@ -108,7 +102,7 @@ namespace Volo.Abp.Caching return options; } } - return _cacheOption.GlobalCacheEntryOptions; + return _distributedCacheOption.GlobalCacheEntryOptions; } protected virtual void SetDefaultOptions()