Skip to content

Commit 5f0a8b8

Browse files
authored
Fix policy names (#495)
1 parent 9289ac4 commit 5f0a8b8

File tree

6 files changed

+10
-11
lines changed

6 files changed

+10
-11
lines changed

BitFaster.Caching.UnitTests/Lru/AfterAccessLongTicksPolicyTests.cs renamed to BitFaster.Caching.UnitTests/Lru/AfterAccessPolicyTests.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,22 @@
1010

1111
namespace BitFaster.Caching.UnitTests.Lru
1212
{
13-
public class AfterAccessLongTicksPolicyTests
13+
public class AfterAccessPolicyTests
1414
{
15-
private readonly AfterAccessLongTicksPolicy<int, int> policy = new AfterAccessLongTicksPolicy<int, int>(TimeSpan.FromSeconds(10));
15+
private readonly AfterAccessPolicy<int, int> policy = new AfterAccessPolicy<int, int>(TimeSpan.FromSeconds(10));
1616

1717
[Fact]
1818
public void WhenTtlIsTimeSpanMaxThrow()
1919
{
20-
Action constructor = () => { new AfterAccessLongTicksPolicy<int, int>(TimeSpan.MaxValue); };
20+
Action constructor = () => { new AfterAccessPolicy<int, int>(TimeSpan.MaxValue); };
2121

2222
constructor.Should().Throw<ArgumentOutOfRangeException>();
2323
}
2424

2525
[Fact]
2626
public void WhenTtlIsZeroThrow()
2727
{
28-
Action constructor = () => { new AfterAccessLongTicksPolicy<int, int>(TimeSpan.Zero); };
28+
Action constructor = () => { new AfterAccessPolicy<int, int>(TimeSpan.Zero); };
2929

3030
constructor.Should().Throw<ArgumentOutOfRangeException>();
3131
}
@@ -38,7 +38,7 @@ public void WhenTtlIsMaxSetAsMax()
3838
#else
3939
var maxRepresentable = Time.MaxRepresentable;
4040
#endif
41-
var policy = new AfterAccessLongTicksPolicy<int, int>(maxRepresentable);
41+
var policy = new AfterAccessPolicy<int, int>(maxRepresentable);
4242
policy.TimeToLive.Should().BeCloseTo(maxRepresentable, TimeSpan.FromTicks(20));
4343
}
4444

BitFaster.Caching.UnitTests/Lru/DiscretePolicyTests.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
using System;
2-
using System.Diagnostics;
32
using System.Threading.Tasks;
43
using BitFaster.Caching.Lru;
54
using FluentAssertions;

BitFaster.Caching/Lru/AfterAccessLongTicksPolicy.cs renamed to BitFaster.Caching/Lru/AfterAccessPolicy.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ namespace BitFaster.Caching.Lru
66
/// <summary>
77
/// Implement an expire after access policy.
88
/// </summary>
9-
internal readonly struct AfterAccessLongTicksPolicy<K, V> : IItemPolicy<K, V, LongTickCountLruItem<K, V>>
9+
internal readonly struct AfterAccessPolicy<K, V> : IItemPolicy<K, V, LongTickCountLruItem<K, V>>
1010
{
1111
private readonly Duration timeToLive;
1212
private readonly Time time;
@@ -18,7 +18,7 @@ namespace BitFaster.Caching.Lru
1818
/// Initializes a new instance of the AfterReadTickCount64Policy class with the specified time to live.
1919
/// </summary>
2020
/// <param name="timeToLive">The time to live.</param>
21-
public AfterAccessLongTicksPolicy(TimeSpan timeToLive)
21+
public AfterAccessPolicy(TimeSpan timeToLive)
2222
{
2323
if (timeToLive <= TimeSpan.Zero || timeToLive > Time.MaxRepresentable)
2424
Throw.ArgOutOfRange(nameof(timeToLive), $"Value must greater than zero and less than {Time.MaxRepresentable}");

BitFaster.Caching/Lru/ConcurrentLru.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ internal static ICache<K, V> Create<K, V>(LruInfo<K> info)
4141

4242
private static ICache<K, V> CreateExpireAfterAccess<K, V, TP>(LruInfo<K> info) where TP : struct, ITelemetryPolicy<K, V>
4343
{
44-
return new ConcurrentLruCore<K, V, LongTickCountLruItem<K, V>, AfterAccessLongTicksPolicy<K, V>, TP>(
45-
info.ConcurrencyLevel, info.Capacity, info.KeyComparer, new AfterAccessLongTicksPolicy<K, V>(info.TimeToExpireAfterAccess.Value), default);
44+
return new ConcurrentLruCore<K, V, LongTickCountLruItem<K, V>, AfterAccessPolicy<K, V>, TP>(
45+
info.ConcurrencyLevel, info.Capacity, info.KeyComparer, new AfterAccessPolicy<K, V>(info.TimeToExpireAfterAccess.Value), default);
4646
}
4747

4848
private static ICache<K, V> CreateExpireAfter<K, V, TP>(LruInfo<K> info, IExpiryCalculator<K, V> expiry) where TP : struct, ITelemetryPolicy<K, V>

BitFaster.Caching/Lru/ConcurrentLruCore.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -805,7 +805,7 @@ private static CachePolicy CreatePolicy(ConcurrentLruCore<K, V, I, P, T> lru)
805805
{
806806
var p = new Proxy(lru);
807807

808-
if (typeof(P) == typeof(AfterAccessLongTicksPolicy<K, V>))
808+
if (typeof(P) == typeof(AfterAccessPolicy<K, V>))
809809
{
810810
return new CachePolicy(new Optional<IBoundedPolicy>(p), Optional<ITimePolicy>.None(), new Optional<ITimePolicy>(p), Optional<IDiscreteTimePolicy>.None());
811811
}

0 commit comments

Comments
 (0)