Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 4 additions & 11 deletions BitFaster.Caching/Lru/EqualCapacityPartition.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,30 +9,23 @@ namespace BitFaster.Caching.Lru
[DebuggerDisplay("{Hot}/{Warm}/{Cold}")]
public class EqualCapacityPartition : ICapacityPartition
{
private readonly int hotCapacity;
private readonly int warmCapacity;
private readonly int coldCapacity;

/// <summary>
/// Initializes a new instance of the EqualCapacityPartition class with the specified total capacity.
/// </summary>
/// <param name="totalCapacity">The total capacity.</param>
public EqualCapacityPartition(int totalCapacity)
{
var (hot, warm, cold) = ComputeQueueCapacity(totalCapacity);
this.hotCapacity = hot;
this.warmCapacity = warm;
this.coldCapacity = cold;
(Hot, Warm, Cold) = ComputeQueueCapacity(totalCapacity);
}

///<inheritdoc/>
public int Cold => this.coldCapacity;
public int Cold { get; }

///<inheritdoc/>
public int Warm => this.warmCapacity;
public int Warm { get; }

///<inheritdoc/>
public int Hot => this.hotCapacity;
public int Hot { get; }

private static (int hot, int warm, int cold) ComputeQueueCapacity(int capacity)
{
Expand Down
Loading