From 0d11e588747602d3a133685e807a63f2171a35b0 Mon Sep 17 00:00:00 2001 From: Alex Peck Date: Tue, 14 Apr 2026 12:16:36 -0700 Subject: [PATCH] fix --- BitFaster.Caching/Lfu/ConcurrentLfuCore.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/BitFaster.Caching/Lfu/ConcurrentLfuCore.cs b/BitFaster.Caching/Lfu/ConcurrentLfuCore.cs index bf12000f..3b031a7c 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);