Skip to content

Commit adc24b1

Browse files
authored
rem dep props (#158)
1 parent 6a264d8 commit adc24b1

File tree

4 files changed

+0
-110
lines changed

4 files changed

+0
-110
lines changed

BitFaster.Caching.UnitTests/Lru/ConcurrentLruTests.cs

Lines changed: 0 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -187,17 +187,6 @@ public void WhenItemDoesNotExistTryGetReturnsNullAndFalse()
187187
value.Should().BeNull();
188188
}
189189

190-
[Fact]
191-
public void WhenItemIsAddedThenRetrievedHitRatioIsHalf()
192-
{
193-
lru.GetOrAdd(1, valueFactory.Create);
194-
bool result = lru.TryGet(1, out var value);
195-
196-
#pragma warning disable CS0618 // Type or member is obsolete
197-
lru.HitRatio.Should().Be(0.5);
198-
#pragma warning restore CS0618 // Type or member is obsolete
199-
}
200-
201190
[Fact]
202191
public void MetricsAreEnabled()
203192
{
@@ -505,34 +494,6 @@ public void WhenValueExpiresItIsDisposed()
505494
disposableValueFactory.Items[6].IsDisposed.Should().BeFalse();
506495
}
507496

508-
[Fact]
509-
public void WhenValueEvictedItemRemovedDeprecatedEventIsFired()
510-
{
511-
var lruEvents = new ConcurrentLru<int, int>(1, new EqualCapacityPartition(6), EqualityComparer<int>.Default);
512-
#pragma warning disable CS0618 // Type or member is obsolete
513-
lruEvents.ItemRemoved += OnLruItemRemoved;
514-
#pragma warning restore CS0618 // Type or member is obsolete
515-
516-
// First 6 adds
517-
// hot[6, 5], warm[2, 1], cold[4, 3]
518-
// =>
519-
// hot[8, 7], warm[1, 0], cold[6, 5], evicted[4, 3]
520-
for (int i = 0; i < 8; i++)
521-
{
522-
lruEvents.GetOrAdd(i + 1, i => i + 1);
523-
}
524-
525-
removedItems.Count.Should().Be(2);
526-
527-
removedItems[0].Key.Should().Be(3);
528-
removedItems[0].Value.Should().Be(4);
529-
removedItems[0].Reason.Should().Be(ItemRemovedReason.Evicted);
530-
531-
removedItems[1].Key.Should().Be(4);
532-
removedItems[1].Value.Should().Be(5);
533-
removedItems[1].Reason.Should().Be(ItemRemovedReason.Evicted);
534-
}
535-
536497

537498
[Fact]
538499
public void WhenValueEvictedItemRemovedEventIsFired()

BitFaster.Caching.UnitTests/Lru/ConcurrentTLruTests.cs

Lines changed: 0 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -82,34 +82,6 @@ public async Task WhenItemIsUpdatedTtlIsExtended()
8282
lru.TryGet(1, out var value).Should().BeTrue();
8383
}
8484

85-
[Fact]
86-
public void WhenValueEvictedItemRemovedDeprecatedEventIsFired()
87-
{
88-
var lruEvents = new ConcurrentTLru<int, int>(1, new EqualCapacityPartition(6), EqualityComparer<int>.Default, timeToLive);
89-
#pragma warning disable CS0618 // Type or member is obsolete
90-
lruEvents.ItemRemoved += OnLruItemRemoved;
91-
#pragma warning restore CS0618 // Type or member is obsolete
92-
93-
// First 6 adds
94-
// hot[6, 5], warm[2, 1], cold[4, 3]
95-
// =>
96-
// hot[8, 7], warm[1, 0], cold[6, 5], evicted[4, 3]
97-
for (int i = 0; i < 8; i++)
98-
{
99-
lruEvents.GetOrAdd(i + 1, i => i + 1);
100-
}
101-
102-
removedItems.Count.Should().Be(2);
103-
104-
removedItems[0].Key.Should().Be(3);
105-
removedItems[0].Value.Should().Be(4);
106-
removedItems[0].Reason.Should().Be(ItemRemovedReason.Evicted);
107-
108-
removedItems[1].Key.Should().Be(4);
109-
removedItems[1].Value.Should().Be(5);
110-
removedItems[1].Reason.Should().Be(ItemRemovedReason.Evicted);
111-
}
112-
11385
[Fact]
11486
public void WhenValueEvictedItemRemovedEventIsFired()
11587
{
@@ -151,17 +123,6 @@ public void WhenItemRemovedEventIsUnregisteredEventIsNotFired()
151123
removedItems.Count.Should().Be(0);
152124
}
153125

154-
[Fact]
155-
public void WhenItemIsAddedThenRetrievedHitRatioIsHalf()
156-
{
157-
lru.GetOrAdd(1, valueFactory.Create);
158-
bool result = lru.TryGet(1, out var value);
159-
160-
#pragma warning disable CS0618 // Type or member is obsolete
161-
lru.HitRatio.Should().Be(0.5);
162-
#pragma warning restore CS0618 // Type or member is obsolete
163-
}
164-
165126
[Fact]
166127
public async Task WhenItemsAreExpiredExpireRemovesExpiredItems()
167128
{

BitFaster.Caching/Lru/ConcurrentLru.cs

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -42,21 +42,5 @@ public ConcurrentLru(int concurrencyLevel, ICapacityPartition capacity, IEqualit
4242
: base(concurrencyLevel, capacity, comparer, default, default)
4343
{
4444
}
45-
46-
/// <summary>
47-
/// Gets the ratio of hits to misses, where a value of 1 indicates 100% hits.
48-
/// </summary>
49-
[ObsoleteAttribute("This property is obsolete. Use Metrics instead.", false)]
50-
public double HitRatio => this.telemetryPolicy.HitRatio;
51-
52-
/// <summary>
53-
/// Occurs when an item is removed from the cache.
54-
/// </summary>
55-
[ObsoleteAttribute("This property is obsolete. Use Events instead.", false)]
56-
public event EventHandler<ItemRemovedEventArgs<K, V>> ItemRemoved
57-
{
58-
add { this.Events.ItemRemoved += value; }
59-
remove { this.Events.ItemRemoved -= value; }
60-
}
6145
}
6246
}

BitFaster.Caching/Lru/ConcurrentTLru.cs

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -46,22 +46,6 @@ public ConcurrentTLru(int concurrencyLevel, ICapacityPartition capacity, IEquali
4646
{
4747
}
4848

49-
/// <summary>
50-
/// Gets the ratio of hits to misses, where a value of 1 indicates 100% hits.
51-
/// </summary>
52-
[ObsoleteAttribute("This property is obsolete. Use Metrics instead.", false)]
53-
public double HitRatio => this.telemetryPolicy.HitRatio;
54-
55-
/// <summary>
56-
/// Occurs when an item is removed from the cache.
57-
/// </summary>
58-
[ObsoleteAttribute("This property is obsolete. Use Events instead.", false)]
59-
public event EventHandler<ItemRemovedEventArgs<K, V>> ItemRemoved
60-
{
61-
add { this.Events.ItemRemoved += value; }
62-
remove { this.Events.ItemRemoved -= value; }
63-
}
64-
6549
/// <summary>
6650
/// Remove all expired items from the cache.
6751
/// </summary>

0 commit comments

Comments
 (0)