<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="11.0.0-preview.3.26207.106" />

Microsoft.Extensions.Caching.Memory.MemoryCache

public class MemoryCache : IMemoryCache, IDisposable
Implements IMemoryCache using a dictionary to store its entries.
public int Count { get; }

Gets the count of the current entries for diagnostic purposes.

public IEnumerable<object> Keys { get; }

Gets an enumerable of the all the keys in the MemoryCache.

public MemoryCache(IOptions<MemoryCacheOptions> optionsAccessor)

Creates a new MemoryCache instance.

public MemoryCache(IOptions<MemoryCacheOptions> optionsAccessor, ILoggerFactory loggerFactory)

Creates a new MemoryCache instance.

public void Clear()

Removes all keys and values from the cache.

public void Compact(double percentage)

public ICacheEntry CreateEntry(object key)

public void Dispose()

protected virtual void Dispose(bool disposing)

Disposes the cache and clears all entries.

public MemoryCacheStatistics GetCurrentStatistics()

Gets a snapshot of the current statistics for the memory cache.

public void Remove(object key)

public bool TryGetValue(object key, out object result)