Skip to content

Use auto-implemented properties #669

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Feb 15, 2025
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