Skip to content

Commit 5c2a527

Browse files
authored
trim (#435)
1 parent 1227540 commit 5c2a527

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

BitFaster.Caching/Lfu/ConcurrentLfu.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,9 +188,13 @@ public void Trim(int itemCount)
188188
TakeCandidatesInLruOrder(this.probationLru, candidates, itemCount);
189189
TakeCandidatesInLruOrder(this.protectedLru, candidates, itemCount);
190190
TakeCandidatesInLruOrder(this.windowLru, candidates, itemCount);
191-
}
192-
191+
}
192+
193+
#if NET6_0_OR_GREATER
194+
foreach (var candidate in CollectionsMarshal.AsSpan(candidates))
195+
#else
193196
foreach (var candidate in candidates)
197+
#endif
194198
{
195199
this.TryRemove(candidate.Key);
196200
}

0 commit comments

Comments
 (0)