Browse Source

Remove unnecessary cacheOption.

pull/1969/head
maliming 7 years ago
parent
commit
ed62b77efd
  1. 14
      framework/src/Volo.Abp.Caching/Volo/Abp/Caching/DistributedCache.cs

14
framework/src/Volo.Abp.Caching/Volo/Abp/Caching/DistributedCache.cs

@ -19,13 +19,11 @@ namespace Volo.Abp.Caching
where TCacheItem : class where TCacheItem : class
{ {
public DistributedCache( public DistributedCache(
IOptions<CacheOptions> cacheOption, IOptions<AbpDistributedCacheOptions> distributedCacheOption,
IOptions<DistributedCacheOptions> distributedCacheOption,
IDistributedCache cache, IDistributedCache cache,
ICancellationTokenProvider cancellationTokenProvider, ICancellationTokenProvider cancellationTokenProvider,
IDistributedCacheSerializer serializer, IDistributedCacheSerializer serializer,
ICurrentTenant currentTenant) : base( ICurrentTenant currentTenant) : base(
cacheOption: cacheOption,
distributedCacheOption: distributedCacheOption, distributedCacheOption: distributedCacheOption,
cache: cache, cache: cache,
cancellationTokenProvider: cancellationTokenProvider, cancellationTokenProvider: cancellationTokenProvider,
@ -62,12 +60,9 @@ namespace Volo.Abp.Caching
protected DistributedCacheEntryOptions DefaultCacheOptions; protected DistributedCacheEntryOptions DefaultCacheOptions;
private readonly AbpDistributedCacheOptions _cacheOption;
private readonly AbpDistributedCacheOptions _distributedCacheOption; private readonly AbpDistributedCacheOptions _distributedCacheOption;
public DistributedCache( public DistributedCache(
IOptions<AbpDistributedCacheOptions> cacheOption,
IOptions<AbpDistributedCacheOptions> distributedCacheOption, IOptions<AbpDistributedCacheOptions> distributedCacheOption,
IDistributedCache cache, IDistributedCache cache,
ICancellationTokenProvider cancellationTokenProvider, ICancellationTokenProvider cancellationTokenProvider,
@ -75,7 +70,6 @@ namespace Volo.Abp.Caching
ICurrentTenant currentTenant) ICurrentTenant currentTenant)
{ {
_distributedCacheOption = distributedCacheOption.Value; _distributedCacheOption = distributedCacheOption.Value;
_cacheOption = cacheOption.Value;
Cache = cache; Cache = cache;
CancellationTokenProvider = cancellationTokenProvider; CancellationTokenProvider = cancellationTokenProvider;
Logger = NullLogger<DistributedCache<TCacheItem, TCacheKey>>.Instance; Logger = NullLogger<DistributedCache<TCacheItem, TCacheKey>>.Instance;
@ -88,7 +82,7 @@ namespace Volo.Abp.Caching
} }
protected virtual string NormalizeKey(TCacheKey key) 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) if (!IgnoreMultiTenancy && CurrentTenant.Id.HasValue)
{ {
@ -100,7 +94,7 @@ namespace Volo.Abp.Caching
protected virtual DistributedCacheEntryOptions GetDefaultCacheEntryOptions() protected virtual DistributedCacheEntryOptions GetDefaultCacheEntryOptions()
{ {
foreach (var configure in _cacheOption.CacheConfigurators) foreach (var configure in _distributedCacheOption.CacheConfigurators)
{ {
var options = configure.Invoke(CacheName); var options = configure.Invoke(CacheName);
if (options != null) if (options != null)
@ -108,7 +102,7 @@ namespace Volo.Abp.Caching
return options; return options;
} }
} }
return _cacheOption.GlobalCacheEntryOptions; return _distributedCacheOption.GlobalCacheEntryOptions;
} }
protected virtual void SetDefaultOptions() protected virtual void SetDefaultOptions()

Loading…
Cancel
Save