Skip to content

Commit 9519352

Browse files
authored
Use auto-implemented properties (#669)
* Use auto-implemented properties * Further simplify ---------
1 parent 55ac07e commit 9519352

File tree

1 file changed

+4
-11
lines changed

1 file changed

+4
-11
lines changed

BitFaster.Caching/Lru/EqualCapacityPartition.cs

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,30 +9,23 @@ namespace BitFaster.Caching.Lru
99
[DebuggerDisplay("{Hot}/{Warm}/{Cold}")]
1010
public class EqualCapacityPartition : ICapacityPartition
1111
{
12-
private readonly int hotCapacity;
13-
private readonly int warmCapacity;
14-
private readonly int coldCapacity;
15-
1612
/// <summary>
1713
/// Initializes a new instance of the EqualCapacityPartition class with the specified total capacity.
1814
/// </summary>
1915
/// <param name="totalCapacity">The total capacity.</param>
2016
public EqualCapacityPartition(int totalCapacity)
2117
{
22-
var (hot, warm, cold) = ComputeQueueCapacity(totalCapacity);
23-
this.hotCapacity = hot;
24-
this.warmCapacity = warm;
25-
this.coldCapacity = cold;
18+
(Hot, Warm, Cold) = ComputeQueueCapacity(totalCapacity);
2619
}
2720

2821
///<inheritdoc/>
29-
public int Cold => this.coldCapacity;
22+
public int Cold { get; }
3023

3124
///<inheritdoc/>
32-
public int Warm => this.warmCapacity;
25+
public int Warm { get; }
3326

3427
///<inheritdoc/>
35-
public int Hot => this.hotCapacity;
28+
public int Hot { get; }
3629

3730
private static (int hot, int warm, int cold) ComputeQueueCapacity(int capacity)
3831
{

0 commit comments

Comments
 (0)