<PackageReference Include="Microsoft.Extensions.Caching.Abstractions" Version="10.0.12" />

Microsoft.Extensions.Caching.Memory.CacheExtensions

public static class CacheExtensions
Provides extensions methods for IMemoryCache operations.
namespace Microsoft.Extensions.Caching.Memory { public static class CacheExtensions { public static object Get(this IMemoryCache cache, object key); public static TItem Get<[System.Runtime.CompilerServices.Nullable(2)] TItem>(this IMemoryCache cache, object key); public static bool TryGetValue<[System.Runtime.CompilerServices.Nullable(2)] TItem>(this IMemoryCache cache, object key, out TItem value); public static TItem Set<[System.Runtime.CompilerServices.Nullable(2)] TItem>(this IMemoryCache cache, object key, TItem value); public static TItem Set<[System.Runtime.CompilerServices.Nullable(2)] TItem>(this IMemoryCache cache, object key, TItem value, DateTimeOffset absoluteExpiration); public static TItem Set<[System.Runtime.CompilerServices.Nullable(2)] TItem>(this IMemoryCache cache, object key, TItem value, TimeSpan absoluteExpirationRelativeToNow); public static TItem Set<[System.Runtime.CompilerServices.Nullable(2)] TItem>(this IMemoryCache cache, object key, TItem value, IChangeToken expirationToken); public static TItem Set<[System.Runtime.CompilerServices.Nullable(2)] TItem>(this IMemoryCache cache, object key, TItem value, MemoryCacheEntryOptions options); public static TItem GetOrCreate<[System.Runtime.CompilerServices.Nullable(2)] TItem>(this IMemoryCache cache, object key, Func<ICacheEntry, TItem> factory); public static TItem GetOrCreate<[System.Runtime.CompilerServices.Nullable(2)] TItem>(this IMemoryCache cache, object key, Func<ICacheEntry, TItem> factory, MemoryCacheEntryOptions createOptions); public static Task<TItem> GetOrCreateAsync<[System.Runtime.CompilerServices.Nullable(2)] TItem>(this IMemoryCache cache, object key, Func<ICacheEntry, Task<TItem>> factory); public static Task<TItem> GetOrCreateAsync<[System.Runtime.CompilerServices.Nullable(2)] TItem>(this IMemoryCache cache, object key, Func<ICacheEntry, Task<TItem>> factory, MemoryCacheEntryOptions createOptions); } }