diff --git a/vol.api.sqlsugar/VOL.Core/CacheManager/Service/MemoryCacheService .cs b/vol.api.sqlsugar/VOL.Core/CacheManager/Service/MemoryCacheService .cs index b3a673262669a47e447e576538ddd3f2d31b80a8..a93c7cb32c70940abfade06367207ed9b4faa9d1 100644 --- a/vol.api.sqlsugar/VOL.Core/CacheManager/Service/MemoryCacheService .cs +++ b/vol.api.sqlsugar/VOL.Core/CacheManager/Service/MemoryCacheService .cs @@ -52,11 +52,22 @@ namespace VOL.Core.CacheManager { if (expireSeconds != -1) { - _cache.Set(key, + if (isSliding) + { + _cache.Set(key, value, new MemoryCacheEntryOptions() .SetSlidingExpiration(new TimeSpan(0, 0, expireSeconds)) ); + } + else + { + _cache.Set(key, + value, + new MemoryCacheEntryOptions() + .SetAbsoluteExpiration(new TimeSpan(0, 0, expireSeconds)) + ); + } } else { diff --git a/vol.api/VOL.Core/CacheManager/Service/MemoryCacheService .cs b/vol.api/VOL.Core/CacheManager/Service/MemoryCacheService .cs index b3a673262669a47e447e576538ddd3f2d31b80a8..a93c7cb32c70940abfade06367207ed9b4faa9d1 100644 --- a/vol.api/VOL.Core/CacheManager/Service/MemoryCacheService .cs +++ b/vol.api/VOL.Core/CacheManager/Service/MemoryCacheService .cs @@ -52,11 +52,22 @@ namespace VOL.Core.CacheManager { if (expireSeconds != -1) { - _cache.Set(key, + if (isSliding) + { + _cache.Set(key, value, new MemoryCacheEntryOptions() .SetSlidingExpiration(new TimeSpan(0, 0, expireSeconds)) ); + } + else + { + _cache.Set(key, + value, + new MemoryCacheEntryOptions() + .SetAbsoluteExpiration(new TimeSpan(0, 0, expireSeconds)) + ); + } } else {