feat: 增加 Debug 模式下禁用 Caching 设置

This commit is contained in:
Argo-Tianyi 2022-01-21 12:24:52 +08:00
parent 7411047ea3
commit 41e94ca677
1 changed files with 4 additions and 1 deletions

View File

@ -57,9 +57,12 @@ class DefaultCacheManager : ICacheManager
// 内置缓存策略 缓存相对时间 10 分钟 // 内置缓存策略 缓存相对时间 10 分钟
if (entry.AbsoluteExpiration == null && entry.SlidingExpiration == null && !entry.ExpirationTokens.Any()) if (entry.AbsoluteExpiration == null && entry.SlidingExpiration == null && !entry.ExpirationTokens.Any())
{ {
#if DEBUG
entry.SlidingExpiration = TimeSpan.FromMilliseconds(100);
#else
entry.SlidingExpiration = TimeSpan.FromMinutes(10); entry.SlidingExpiration = TimeSpan.FromMinutes(10);
#endif
} }
entry.RegisterPostEvictionCallback((key, value, reason, state) => entry.RegisterPostEvictionCallback((key, value, reason, state) =>
{ {