Skip to content

Commit 3d09d49

Browse files
author
Travis Whidden
committed
zzzprojects#764 - Rename T1,T2 to TKey, TValue
1 parent 1d3bf0a commit 3d09d49

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/System.Linq.Dynamic.Core/Parser/ThreadSafeSlidingCache.cs

+6-6
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,23 @@
22

33
namespace System.Linq.Dynamic.Core.Parser
44
{
5-
internal class ThreadSafeSlidingCache<T1, T2> where T1 : notnull where T2 : notnull
5+
internal class ThreadSafeSlidingCache<TKey, TValue> where TKey : notnull where TValue : notnull
66
{
7-
private readonly ConcurrentDictionary<T1, (T2 Value, DateTime ExpirationTime)> _cache;
7+
private readonly ConcurrentDictionary<TKey, (TValue Value, DateTime ExpirationTime)> _cache;
88
private readonly TimeSpan _timeToLive;
99
private readonly TimeSpan _cleanupFrequency;
1010
private DateTime _lastCleanupTime = DateTime.MinValue;
1111

1212
public ThreadSafeSlidingCache(TimeSpan timeToLive, TimeSpan? cleanupFrequency = null)
1313
{
14-
_cache = new ConcurrentDictionary<T1, (T2, DateTime)>();
14+
_cache = new ConcurrentDictionary<TKey, (TValue, DateTime)>();
1515
_timeToLive = timeToLive;
1616
_cleanupFrequency = cleanupFrequency ?? TimeSpan.FromSeconds(10);
1717
}
1818

1919
public TimeSpan TimeToLive => _timeToLive;
2020

21-
public void AddOrUpdate(T1 key, T2 value)
21+
public void AddOrUpdate(TKey key, TValue value)
2222
{
2323
if (key == null) throw new ArgumentNullException(nameof(key));
2424
if (value == null) throw new ArgumentNullException(nameof(value));
@@ -29,7 +29,7 @@ public void AddOrUpdate(T1 key, T2 value)
2929
CleanupIfNeeded();
3030
}
3131

32-
public bool TryGetValue(T1 key, out T2 value)
32+
public bool TryGetValue(TKey key, out TValue value)
3333
{
3434
if (key == null) throw new ArgumentNullException(nameof(key));
3535

@@ -54,7 +54,7 @@ public bool TryGetValue(T1 key, out T2 value)
5454
return false;
5555
}
5656

57-
public bool Remove(T1 key)
57+
public bool Remove(TKey key)
5858
{
5959
if (key == null) throw new ArgumentNullException(nameof(key));
6060
var removed = _cache.TryRemove(key, out _);

0 commit comments

Comments
 (0)