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 c51ec76fc1..a72a369655 100644
--- a/framework/src/Volo.Abp.Caching/Volo/Abp/Caching/DistributedCache.cs
+++ b/framework/src/Volo.Abp.Caching/Volo/Abp/Caching/DistributedCache.cs
@@ -21,26 +21,115 @@ namespace Volo.Abp.Caching;
///
/// The type of cache item being cached.
public class DistributedCache :
- DistributedCache,
IDistributedCache
where TCacheItem : class
{
- public DistributedCache(
- IOptions distributedCacheOption,
- IDistributedCache cache,
- ICancellationTokenProvider cancellationTokenProvider,
- IDistributedCacheSerializer serializer,
- IDistributedCacheKeyNormalizer keyNormalizer,
- IServiceScopeFactory serviceScopeFactory,
- IUnitOfWorkManager unitOfWorkManager) : base(
- distributedCacheOption: distributedCacheOption,
- cache: cache,
- cancellationTokenProvider: cancellationTokenProvider,
- serializer: serializer,
- keyNormalizer: keyNormalizer,
- serviceScopeFactory: serviceScopeFactory,
- unitOfWorkManager: unitOfWorkManager)
+ public IDistributedCache InternalCache { get; }
+
+ public DistributedCache(IDistributedCache internalCache)
+ {
+ InternalCache = internalCache;
+ }
+
+ public TCacheItem Get(string key, bool? hideErrors = null, bool considerUow = false)
+ {
+ return InternalCache.Get(key, hideErrors, considerUow);
+ }
+
+ public KeyValuePair[] GetMany(IEnumerable keys, bool? hideErrors = null, bool considerUow = false)
+ {
+ return InternalCache.GetMany(keys, hideErrors, considerUow);
+ }
+
+ public Task[]> GetManyAsync(IEnumerable keys, bool? hideErrors = null, bool considerUow = false, CancellationToken token = default)
+ {
+ return InternalCache.GetManyAsync(keys, hideErrors, considerUow, token);
+ }
+
+ public Task GetAsync(string key, bool? hideErrors = null, bool considerUow = false, CancellationToken token = default)
+ {
+ return InternalCache.GetAsync(key, hideErrors, considerUow, token);
+ }
+
+ public TCacheItem GetOrAdd(string key, Func factory, Func optionsFactory = null, bool? hideErrors = null, bool considerUow = false)
+ {
+ return InternalCache.GetOrAdd(key, factory, optionsFactory, hideErrors, considerUow);
+ }
+
+ public Task GetOrAddAsync(string key, Func> factory, Func optionsFactory = null, bool? hideErrors = null, bool considerUow = false, CancellationToken token = default)
+ {
+ return InternalCache.GetOrAddAsync(key, factory, optionsFactory, hideErrors, considerUow, token);
+ }
+
+ public KeyValuePair[] GetOrAddMany(IEnumerable keys, Func, List>> factory, Func optionsFactory = null, bool? hideErrors = null, bool considerUow = false)
+ {
+ return InternalCache.GetOrAddMany(keys, factory, optionsFactory, hideErrors, considerUow);
+ }
+
+ public Task[]> GetOrAddManyAsync(IEnumerable keys, Func, Task>>> factory, Func optionsFactory = null, bool? hideErrors = null, bool considerUow = false, CancellationToken token = default)
+ {
+ return InternalCache.GetOrAddManyAsync(keys, factory, optionsFactory, hideErrors, considerUow, token);
+ }
+
+ public void Set(string key, TCacheItem value, DistributedCacheEntryOptions options = null, bool? hideErrors = null, bool considerUow = false)
+ {
+ InternalCache.Set(key, value, options, hideErrors, considerUow);
+ }
+
+ public Task SetAsync(string key, TCacheItem value, DistributedCacheEntryOptions options = null, bool? hideErrors = null, bool considerUow = false, CancellationToken token = default)
+ {
+ return InternalCache.SetAsync(key, value, options, hideErrors, considerUow, token);
+ }
+
+ public void SetMany(IEnumerable> items, DistributedCacheEntryOptions options = null, bool? hideErrors = null, bool considerUow = false)
+ {
+ InternalCache.SetMany(items, options, hideErrors, considerUow);
+ }
+
+ public Task SetManyAsync(IEnumerable> items, DistributedCacheEntryOptions options = null, bool? hideErrors = null, bool considerUow = false, CancellationToken token = default)
+ {
+ return InternalCache.SetManyAsync(items, options, hideErrors, considerUow, token);
+ }
+
+ public void Refresh(string key, bool? hideErrors = null)
+ {
+ InternalCache.Refresh(key, hideErrors);
+ }
+
+ public Task RefreshAsync(string key, bool? hideErrors = null, CancellationToken token = default)
+ {
+ return InternalCache.RefreshAsync(key, hideErrors, token);
+ }
+
+ public void RefreshMany(IEnumerable keys, bool? hideErrors = null)
+ {
+ InternalCache.RefreshMany(keys, hideErrors);
+ }
+
+ public Task RefreshManyAsync(IEnumerable keys, bool? hideErrors = null, CancellationToken token = default)
+ {
+ return InternalCache.RefreshManyAsync(keys, hideErrors, token);
+ }
+
+ public void Remove(string key, bool? hideErrors = null, bool considerUow = false)
+ {
+ InternalCache.Remove(key, hideErrors, considerUow);
+ }
+
+ public Task RemoveAsync(string key, bool? hideErrors = null, bool considerUow = false, CancellationToken token = default)
+ {
+ return InternalCache.RemoveAsync(key, hideErrors, considerUow, token);
+ }
+
+ public void RemoveMany(IEnumerable keys, bool? hideErrors = null, bool considerUow = false)
+ {
+ InternalCache.RemoveMany(keys, hideErrors, considerUow);
+ }
+
+ public Task RemoveManyAsync(IEnumerable keys, bool? hideErrors = null, bool considerUow = false,
+ CancellationToken token = default)
{
+ return InternalCache.RemoveManyAsync(keys, hideErrors, considerUow, token);
}
}
diff --git a/framework/src/Volo.Abp.Caching/Volo/Abp/Caching/IDistributedCache.cs b/framework/src/Volo.Abp.Caching/Volo/Abp/Caching/IDistributedCache.cs
index 21a2842e15..ab3ca560a8 100644
--- a/framework/src/Volo.Abp.Caching/Volo/Abp/Caching/IDistributedCache.cs
+++ b/framework/src/Volo.Abp.Caching/Volo/Abp/Caching/IDistributedCache.cs
@@ -14,6 +14,7 @@ namespace Volo.Abp.Caching;
public interface IDistributedCache : IDistributedCache
where TCacheItem : class
{
+ IDistributedCache InternalCache { get; }
}
///
diff --git a/framework/test/Volo.Abp.Caching.Tests/Volo/Abp/Caching/DistributedCache_ConfigureOptions_Test.cs b/framework/test/Volo.Abp.Caching.Tests/Volo/Abp/Caching/DistributedCache_ConfigureOptions_Test.cs
index 12c8a16833..513423a781 100644
--- a/framework/test/Volo.Abp.Caching.Tests/Volo/Abp/Caching/DistributedCache_ConfigureOptions_Test.cs
+++ b/framework/test/Volo.Abp.Caching.Tests/Volo/Abp/Caching/DistributedCache_ConfigureOptions_Test.cs
@@ -34,7 +34,19 @@ public class DistributedCache_ConfigureOptions_Test : AbpIntegratedTest