|
6 | 6 |
|
7 | 7 | namespace BitFaster.Caching.Lru |
8 | 8 | { |
| 9 | + ///<inheritdoc/> |
9 | 10 | public sealed class ConcurrentTLru<K, V> : TemplateConcurrentLru<K, V, LongTickCountLruItem<K, V>, TLruLongTicksPolicy<K, V>, HitCounter> |
10 | 11 | { |
11 | | - public ConcurrentTLru(int capacity) |
12 | | - : base(Defaults.ConcurrencyLevel, capacity, EqualityComparer<K>.Default, new TLruLongTicksPolicy<K, V>(), new HitCounter()) |
| 12 | + /// <summary> |
| 13 | + /// Initializes a new instance of the ConcurrentTLru class with the specified capacity and time to live that has the default |
| 14 | + /// concurrency level, and uses the default comparer for the key type. |
| 15 | + /// </summary> |
| 16 | + /// <param name="capacity">The maximum number of elements that the ConcurrentTLru can contain.</param> |
| 17 | + /// <param name="timeToLive">The time to live for cached values.</param> |
| 18 | + public ConcurrentTLru(int capacity, TimeSpan timeToLive) |
| 19 | + : base(Defaults.ConcurrencyLevel, capacity, EqualityComparer<K>.Default, new TLruLongTicksPolicy<K, V>(timeToLive), new HitCounter()) |
13 | 20 | { |
14 | 21 | } |
15 | 22 |
|
| 23 | + /// <summary> |
| 24 | + /// Initializes a new instance of the ConcurrentTLru class that has the specified concurrency level, has the |
| 25 | + /// specified initial capacity, uses the specified IEqualityComparer<T>, and has the specified time to live. |
| 26 | + /// </summary> |
| 27 | + /// <param name="concurrencyLevel">The estimated number of threads that will update the ConcurrentTLru concurrently.</param> |
| 28 | + /// <param name="capacity">The maximum number of elements that the ConcurrentTLru can contain.</param> |
| 29 | + /// <param name="comparer">The IEqualityComparer<T> implementation to use when comparing keys.</param> |
| 30 | + /// <param name="timeToLive">The time to live for cached values.</param> |
16 | 31 | public ConcurrentTLru(int concurrencyLevel, int capacity, IEqualityComparer<K> comparer, TimeSpan timeToLive) |
17 | 32 | : base(concurrencyLevel, capacity, comparer, new TLruLongTicksPolicy<K, V>(timeToLive), new HitCounter()) |
18 | 33 | { |
19 | 34 | } |
20 | 35 |
|
| 36 | + /// <summary> |
| 37 | + /// Gets the ratio of hits to misses, where a value of 1 indicates 100% hits. |
| 38 | + /// </summary> |
21 | 39 | public double HitRatio => this.hitCounter.HitRatio; |
22 | 40 | } |
23 | 41 | } |
0 commit comments