LazyCache icon indicating copy to clipboard operation
LazyCache copied to clipboard

Exposes Compact

Open judahr opened this issue 3 years ago • 1 comments

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

judahr avatar Jan 19 '22 04:01 judahr

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.

alastairtree avatar Aug 08 '22 08:08 alastairtree