mirror of
https://github.com/cq-panda/Vue.NetCore.git
synced 2026-10-17 05:20:50 +08:00
修复MemoryCacheService使用Add方法添加缓存默认是滑动过期的bug(by @不容易ljg)
This commit is contained in:
@@ -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
|
||||
{
|
||||
|
||||
@@ -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
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user