<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="10.0.10" />

Microsoft.Extensions.DependencyInjection.MemoryCacheServiceCollectionExtensions

Extension methods for setting up memory cache related services in an IServiceCollection.
public static IServiceCollection AddDistributedMemoryCache(this IServiceCollection services)

Adds a default implementation of IDistributedCache that stores items in memory to the IServiceCollection. Frameworks that require a distributed cache to work can safely add this dependency as part of their dependency list to ensure that there is at least one implementation available.

public static IServiceCollection AddDistributedMemoryCache(this IServiceCollection services, Action<MemoryDistributedCacheOptions> setupAction)

Adds a default implementation of IDistributedCache that stores items in memory to the IServiceCollection. Frameworks that require a distributed cache to work can safely add this dependency as part of their dependency list to ensure that there is at least one implementation available.

public static IServiceCollection AddMemoryCache(this IServiceCollection services)

Adds a non distributed in-memory implementation of IMemoryCache to the IServiceCollection.

public static IServiceCollection AddMemoryCache(this IServiceCollection services, Action<MemoryCacheOptions> setupAction)

Adds a non distributed in-memory implementation of IMemoryCache to the IServiceCollection.