Skip to content

Conversation

@bitfaster
Copy link
Owner

@bitfaster bitfaster commented Jul 25, 2022

Define a policy property on ICache to collect policy related state/methods.

Trim/Capacity/TTL is now scoped to the relevant policy as follows:

var lru = new ConcurrentLruBuilder<int, int>()
    .Build();

int capacity = lru.Policy.Eviction.Capacity;
lru.Policy.Eviction.Trim();
var tlru = new ConcurrentLruBuilder<int, int>()
    .WithExpireAfterWrite(TimeSpan.FromSeconds(1))
    .Build();

TimeSpan ttl = tlru.Policy.ExpireAfterWrite.TimeToLive;
tlru.Policy.ExpireAfterWrite.TrimExpired();

@bitfaster bitfaster marked this pull request as ready for review July 26, 2022 19:21
@bitfaster bitfaster merged commit b0021ed into main Jul 26, 2022
@bitfaster bitfaster deleted the users/alexpeck/policy branch July 26, 2022 19:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants