Skip to content

Commit 240de5e

Browse files
authored
private (#248)
1 parent e4fe6df commit 240de5e

File tree

3 files changed

+4
-10
lines changed

3 files changed

+4
-10
lines changed

BitFaster.Caching.UnitTests/Lfu/CmSketchTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public class CmSketchTests
1616
[Fact]
1717
public void WhenCapacityIsZeroDefaultsSelected()
1818
{
19-
sketch.EnsureCapacity(0);
19+
sketch = new CmSketch<int>(0, EqualityComparer<int>.Default);
2020

2121
sketch.ResetSampleSize.Should().Be(10);
2222
}
@@ -55,7 +55,7 @@ public void WhenSampleSizeExceededCountIsReset()
5555
{
5656
bool reset = false;
5757

58-
sketch.EnsureCapacity(64);
58+
sketch = new CmSketch<int>(64, EqualityComparer<int>.Default);
5959

6060
for (int i = 1; i < 20 * 64; i++)
6161
{

BitFaster.Caching/Lfu/CmSketch.cs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,7 @@ public CmSketch(long maximumSize, IEqualityComparer<T> comparer)
4747
/// </summary>
4848
public int Size => this.size;
4949

50-
/// <summary>
51-
/// Initialize such that the count min sketch can accurately estimate the count for values given
52-
/// a maximum size.
53-
/// </summary>
54-
/// <param name="maximumSize">The maximum size.</param>
55-
public void EnsureCapacity(long maximumSize)
50+
private void EnsureCapacity(long maximumSize)
5651
{
5752
int maximum = (int)Math.Min(maximumSize, int.MaxValue >> 1);
5853

BitFaster.Caching/Lfu/ConcurrentLfu.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,7 @@ public ConcurrentLfu(int concurrencyLevel, int capacity, IScheduler scheduler, I
8787
int writeBufferSize = Math.Min(BitOps.CeilingPowerOfTwo(capacity), 128);
8888
this.writeBuffer = new MpscBoundedBuffer<LfuNode<K, V>>(writeBufferSize);
8989

90-
this.cmSketch = new CmSketch<K>(1, comparer);
91-
this.cmSketch.EnsureCapacity(capacity);
90+
this.cmSketch = new CmSketch<K>(capacity, comparer);
9291
this.windowLru = new LfuNodeList<K, V>();
9392
this.probationLru = new LfuNodeList<K, V>();
9493
this.protectedLru = new LfuNodeList<K, V>();

0 commit comments

Comments
 (0)