refactor: 代码重构

This commit is contained in:
Argo-Tianyi 2022-01-12 12:56:15 +08:00
parent eb3ce91948
commit 5096910ba3
1 changed files with 5 additions and 6 deletions

View File

@ -52,7 +52,7 @@ class DefaultCacheManager : ICacheManager
if (entry.AbsoluteExpiration == null || entry.SlidingExpiration == null || entry.AbsoluteExpirationRelativeToNow == null)
{
// 缓存 10 分钟
entry.SlidingExpiration = TimeSpan.FromSeconds(600);
entry.SlidingExpiration = TimeSpan.FromMinutes(10);
}
if (entry.ExpirationTokens.Count == 0)
@ -82,13 +82,12 @@ class DefaultCacheManager : ICacheManager
{
if (!string.IsNullOrEmpty(key))
{
var cacheKey = Keys.LastOrDefault(item => item.Key == key);
if (cacheKey.Token != null)
var (Key, Token) = Keys.LastOrDefault(item => item.Key == key);
if (Token != null)
{
cacheKey.Token.Cancel();
cacheKey.Token.Dispose();
Token.Cancel();
Token.Dispose();
}
Keys.Remove(cacheKey);
}
else
{