Skip to content

Commit 23e2617

Browse files
committed
use static lambdas and discards for improved clarity and performance
1 parent 004dfad commit 23e2617

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

FastCache/FastCache.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ public void AddOrUpdate(TKey key, TValue value, TimeSpan ttl)
118118
{
119119
var ttlValue = new TtlValue(value, ttl);
120120

121-
_dict.AddOrUpdate(key, (k, c) => c, (k, v, c) => c, ttlValue);
121+
_dict.AddOrUpdate(key, static (_, c) => c, static (_, _, c) => c, ttlValue);
122122
}
123123

124124
/// <summary>
@@ -203,7 +203,7 @@ private TValue GetOrAddCore(TKey key, Func<TValue> valueFactory, TimeSpan ttl)
203203
bool wasAdded = false; //flag to indicate "add vs get". TODO: wrap in ref type some day to avoid captures/closures
204204
var ttlValue = _dict.GetOrAdd(
205205
key,
206-
(k) =>
206+
(_) =>
207207
{
208208
wasAdded = true;
209209
return new TtlValue(valueFactory(), ttl);

0 commit comments

Comments
 (0)