Skip to content

Commit 76d8ff0

Browse files
committed
Eliminate unnecessary Task.Run & lambda closure
1 parent c71264d commit 76d8ff0

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
@@ -170,7 +170,7 @@ public bool TryGet(TKey key, out TValue value)
170170
*
171171
* */
172172

173-
Task.Run(() => OnEviction(key));
173+
OnEviction(key);
174174

175175
return false;
176176
}
@@ -210,7 +210,7 @@ private TValue GetOrAddCore(TKey key, Func<TValue> valueFactory, TimeSpan ttl)
210210
if (!wasAdded) //performance hack: skip expiration check if a brand item was just added
211211
{
212212
if (ttlValue.ModifyIfExpired(valueFactory, ttl))
213-
Task.Run(() => OnEviction(key));
213+
OnEviction(key);
214214
}
215215

216216
return ttlValue.Value;

0 commit comments

Comments
 (0)