Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion BitFaster.Caching/Lfu/ConcurrentLfu.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ public sealed class ConcurrentLfu<K, V> : ICache<K, V>, IAsyncCache<K, V>, IBoun
private readonly object maintenanceLock = new();

private readonly IScheduler scheduler;
private readonly Action drainBuffers;

private readonly LfuNode<K, V>[] drainBuffer;

Expand Down Expand Up @@ -110,6 +111,7 @@ public ConcurrentLfu(int concurrencyLevel, int capacity, IScheduler scheduler, I
this.capacity = new LfuCapacityPartition(capacity);

this.scheduler = scheduler;
this.drainBuffers = () => this.DrainBuffers();

this.drainBuffer = new LfuNode<K, V>[this.readBuffer.Capacity];
}
Expand Down Expand Up @@ -532,7 +534,7 @@ private void TryScheduleDrain()
}

this.drainStatus.VolatileWrite(DrainStatus.ProcessingToIdle);
scheduler.Run(() => this.DrainBuffers());
scheduler.Run(this.drainBuffers);
}
}
finally
Expand Down