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

Exposes Compact #172

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Exposes Compact #172

wants to merge 4 commits into from

Conversation

judahr
Copy link

@judahr judahr commented Jan 19, 2022

For issue #171

Exposes Compact as found in MemoryCache. Other providers would have to implement or expose their own as ICacheProvider was changed.

From code comments in MemoryCache:

/// Remove at least the given percentage (0.10 for 10%) of the total entries (or estimated memory?), according to the following policy:
        /// 1. Remove all expired items.
        /// 2. Bucket by CacheItemPriority.
        /// 3. Least recently used objects.
        /// ?. Items with the soonest absolute expiration.
        /// ?. Items with the soonest sliding expiration.
        /// ?. Larger objects - estimated by object graph size, inaccurate.

https://github.com/dotnet/runtime/blob/release/6.0/src/libraries/Microsoft.Extensions.Caching.Memory/src/MemoryCache.cs#L382-L393

@alastairtree
Copy link
Owner

Might be better to have MemoryCacheProvider expose the IMemoryCache and then you can cast and compact (and access everything else on that class) , rather than requiring all providers to implement an interface that may not be relevant.

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