Commit bda7622 Travis Whidden
committed
1 parent a3aede1 commit bda7622 Copy full SHA for bda7622
File tree 1 file changed +7
-3
lines changed
src/System.Linq.Dynamic.Core/Util
1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change 4
4
5
5
namespace System . Linq . Dynamic . Core . Util
6
6
{
7
+ internal static class ThreadSafeSlidingCacheConstants
8
+ {
9
+ // Default cleanup frequency
10
+ public static readonly TimeSpan DefaultCleanupFrequency = TimeSpan . FromMinutes ( 10 ) ;
11
+ }
12
+
7
13
internal class ThreadSafeSlidingCache < TKey , TValue > where TKey : notnull where TValue : notnull
8
14
{
9
- // ReSharper disable once StaticMemberInGenericType
10
- private static readonly TimeSpan _defaultCleanupFrequency = TimeSpan . FromMinutes ( 10 ) ;
11
15
private readonly ConcurrentDictionary < TKey , ( TValue Value , DateTime ExpirationTime ) > _cache ;
12
16
private readonly TimeSpan _cleanupFrequency ;
13
17
private readonly IDateTimeUtils _dateTimeProvider ;
@@ -37,7 +41,7 @@ public ThreadSafeSlidingCache(
37
41
_cache = new ConcurrentDictionary < TKey , ( TValue , DateTime ) > ( ) ;
38
42
TimeToLive = timeToLive ;
39
43
_minCacheItemsBeforeCleanup = minCacheItemsBeforeCleanup ;
40
- _cleanupFrequency = cleanupFrequency ?? _defaultCleanupFrequency ;
44
+ _cleanupFrequency = cleanupFrequency ?? ThreadSafeSlidingCacheConstants . DefaultCleanupFrequency ;
41
45
_deleteExpiredCachedItemsDelegate = Cleanup ;
42
46
_dateTimeProvider = dateTimeProvider ?? new DateTimeUtils ( ) ;
43
47
}
You can’t perform that action at this time.
0 commit comments