Skip to content

Commit 9307b7a

Browse files
authored
rem capacity (#172)
1 parent 23692b1 commit 9307b7a

File tree

10 files changed

+9
-28
lines changed

10 files changed

+9
-28
lines changed

BitFaster.Caching.UnitTests/Atomic/AtomicFactoryAsyncCacheTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public void WhenInnerCacheIsNullCtorThrows()
2929
[Fact]
3030
public void WhenCreatedCapacityPropertyWrapsInnerCache()
3131
{
32-
this.cache.Capacity.Should().Be(capacity);
32+
this.cache.Policy.Eviction.Capacity.Should().Be(capacity);
3333
}
3434

3535
[Fact]

BitFaster.Caching.UnitTests/Atomic/AtomicFactoryCacheTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public void WhenInnerCacheIsNullCtorThrows()
2929
[Fact]
3030
public void WhenCreatedCapacityPropertyWrapsInnerCache()
3131
{
32-
this.cache.Capacity.Should().Be(capacity);
32+
this.cache.Policy.Eviction.Capacity.Should().Be(capacity);
3333
}
3434

3535
[Fact]

BitFaster.Caching.UnitTests/Lru/ConcurrentLruBuilderTests.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public void TestMetricsTLru()
5050
.Build();
5151

5252
lru.Should().BeOfType<ConcurrentTLru<int, int>>();
53-
lru.Capacity.Should().Be(128);
53+
lru.Policy.Eviction.Capacity.Should().Be(128);
5454
}
5555

5656
[Fact]
@@ -128,7 +128,7 @@ public void TestIntCapacity()
128128
.WithCapacity(3)
129129
.Build();
130130

131-
lru.Capacity.Should().Be(3);
131+
lru.Policy.Eviction.Capacity.Should().Be(3);
132132
}
133133

134134
[Fact]
@@ -138,7 +138,7 @@ public void TestPartitionCapacity()
138138
.WithCapacity(new FavorWarmPartition(6))
139139
.Build();
140140

141-
lru.Capacity.Should().Be(6);
141+
lru.Policy.Eviction.Capacity.Should().Be(6);
142142
}
143143

144144
// There are 15 combinations to test:
@@ -201,7 +201,7 @@ public void WithScopedValues()
201201
.Build();
202202

203203
lru.Should().BeOfType<ScopedCache<int, Disposable>>();
204-
lru.Capacity.Should().Be(3);
204+
lru.Policy.Eviction.Capacity.Should().Be(3);
205205
}
206206

207207
// 2
@@ -239,7 +239,7 @@ public void WithAtomicWithScope()
239239
.Build();
240240

241241
lru.Should().BeOfType<AtomicFactoryScopedCache<int, Disposable>>();
242-
lru.Capacity.Should().Be(3);
242+
lru.Policy.Eviction.Capacity.Should().Be(3);
243243
}
244244

245245
// 5
@@ -253,7 +253,7 @@ public void WithScopedWithAtomic()
253253
.Build();
254254

255255
lru.Should().BeOfType<AtomicFactoryScopedCache<int, Disposable>>();
256-
lru.Capacity.Should().Be(3);
256+
lru.Policy.Eviction.Capacity.Should().Be(3);
257257
}
258258

259259
// 6

BitFaster.Caching.UnitTests/ScopedCacheTestBase.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ protected ScopedCacheTestBase(IScopedCache<int, Disposable> cache)
2424
[Fact]
2525
public void WhenCreatedCapacityPropertyWrapsInnerCache()
2626
{
27-
this.cache.Capacity.Should().Be(capacity);
27+
this.cache.Policy.Eviction.Capacity.Should().Be(capacity);
2828
}
2929

3030
[Fact]

BitFaster.Caching/Atomic/AtomicFactoryAsyncCache.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@ public AtomicFactoryAsyncCache(ICache<K, AsyncAtomicFactory<K, V>> cache)
2323
this.eventProxy = new EventProxy(cache.Events);
2424
}
2525

26-
public int Capacity => cache.Capacity;
27-
2826
public int Count => cache.Count;
2927

3028
public ICacheMetrics Metrics => cache.Metrics;

BitFaster.Caching/Atomic/AtomicFactoryCache.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@ public AtomicFactoryCache(ICache<K, AtomicFactory<K, V>> cache)
2323
this.eventProxy = new EventProxy(cache.Events);
2424
}
2525

26-
public int Capacity => this.cache.Capacity;
27-
2826
public int Count => this.cache.Count;
2927

3028
public ICacheMetrics Metrics => this.cache.Metrics;

BitFaster.Caching/Atomic/AtomicFactoryScopedCache.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,6 @@ public AtomicFactoryScopedCache(ICache<K, ScopedAtomicFactory<K, V>> cache)
2424
this.eventProxy = new EventProxy(cache.Events);
2525
}
2626

27-
public int Capacity => this.cache.Capacity;
28-
2927
public int Count => this.cache.Count;
3028

3129
public ICacheMetrics Metrics => this.cache.Metrics;

BitFaster.Caching/ICache.cs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,6 @@ namespace BitFaster.Caching
1313
/// <typeparam name="V">The type of values in the cache.</typeparam>
1414
public interface ICache<K, V> : IEnumerable<KeyValuePair<K, V>>
1515
{
16-
/// <summary>
17-
/// Gets the total number of items that can be stored in the cache.
18-
/// </summary>
19-
int Capacity { get; }
20-
2116
/// <summary>
2217
/// Gets the number of items currently held in the cache.
2318
/// </summary>

BitFaster.Caching/IScopedCache.cs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,6 @@ namespace BitFaster.Caching
1313
/// <typeparam name="V">The type of values in the cache.</typeparam>
1414
public interface IScopedCache<K, V> : IEnumerable<KeyValuePair<K, Scoped<V>>> where V : IDisposable
1515
{
16-
/// <summary>
17-
/// Gets the total number of items that can be stored in the cache.
18-
/// </summary>
19-
int Capacity { get; }
20-
2116
/// <summary>
2217
/// Gets the number of items currently held in the cache.
2318
/// </summary>

BitFaster.Caching/ScopedCache.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,6 @@ public ScopedCache(ICache<K, Scoped<V>> cache)
2929
this.cache = cache;
3030
}
3131

32-
///<inheritdoc/>
33-
public int Capacity => this.cache.Capacity;
34-
3532
///<inheritdoc/>
3633
public int Count => this.cache.Count;
3734

0 commit comments

Comments
 (0)