Skip to content
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

Prevent cache from being resized #59607

Conversation

mapogolions
Copy link
Contributor

@mapogolions mapogolions commented Sep 25, 2021

In the current implementation, additional work is done if a cache entry has already expired, but the cache is large enough to accept it. Consider the case when exceedsCapacity = false and entry.CheckExpired returns true. The cache first grows even if the entry has expired and then shrinks. It would be great in this case not to perform any manipulations regarding the cache size.
The approach I suggested would only change that expired entries won't be able to trigger cache compaction. (exceedsCapacity = true and entry.CheckExpired returns true)

@ghost ghost added the community-contribution Indicates that the PR has been added by a community member label Sep 25, 2021
@ghost
Copy link

ghost commented Sep 25, 2021

Tagging subscribers to this area: @eerhardt, @maryamariyan, @michaelgsharp
See info in area-owners.md if you want to be subscribed.

Issue Details

In the current implementation, additional work is done if a cache entry has already expired, but the cache is large enough to accept it. (e.g. exceedsCapacity = false, entry.CheckExpired returns true)
The cache first grows even if the entry has expired and then shrinks. It would be great in this case not to perform any manipulations regarding the cache size.
The only thing that will change is that expired entries will not be able to trigger cache compaction. (e.g. exceedsCapacity = true and entry.CheckExpired returns true)

Author: mapogolions
Assignees: -
Labels:

area-Extensions-Caching, community-contribution

Milestone: -

@dnfadmin
Copy link

dnfadmin commented Sep 25, 2021

CLA assistant check
All CLA requirements met.

Copy link
Member

@eerhardt eerhardt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this looks good. Thanks for the suggestion.

@Tratcher @adamsitnik - any concerns on this change?

@Tratcher
Copy link
Member

Adding an expired entry should be a rare case, but the change seems fine.

@eerhardt eerhardt merged commit d5d311e into dotnet:main Sep 28, 2021
@pentp pentp mentioned this pull request Oct 1, 2021
@ghost ghost locked as resolved and limited conversation to collaborators Nov 3, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-Extensions-Caching community-contribution Indicates that the PR has been added by a community member
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants