diff --git a/BitFaster.Caching/Lfu/ConcurrentLfuCore.cs b/BitFaster.Caching/Lfu/ConcurrentLfuCore.cs index b6d5be4a..f1af7009 100644 --- a/BitFaster.Caching/Lfu/ConcurrentLfuCore.cs +++ b/BitFaster.Caching/Lfu/ConcurrentLfuCore.cs @@ -717,7 +717,7 @@ private void EvictEntries() EvictFromMain(candidate); } - private LfuNode EvictFromWindow() + private LfuNode? EvictFromWindow() { LfuNode? first = null; @@ -732,17 +732,17 @@ private LfuNode EvictFromWindow() node.Position = Position.Probation; } - return first!; + return first; } private ref struct EvictIterator { private readonly CmSketch sketch; - public LfuNode node; + public LfuNode? node; public int freq; [MethodImpl(MethodImplOptions.AggressiveInlining)] - public EvictIterator(CmSketch sketch, LfuNode node) + public EvictIterator(CmSketch sketch, LfuNode? node) { this.sketch = sketch; this.node = node; @@ -752,7 +752,7 @@ public EvictIterator(CmSketch sketch, LfuNode node) [MethodImpl(MethodImplOptions.AggressiveInlining)] public void Next() { - node = node.Next; + node = node!.Next; if (node != null) { @@ -761,7 +761,7 @@ public void Next() } } - private void EvictFromMain(LfuNode candidateNode) + private void EvictFromMain(LfuNode? candidateNode) { var victim = new EvictIterator(this.cmSketch, this.probationLru.First); // victims are LRU position in probation var candidate = new EvictIterator(this.cmSketch, candidateNode);