MemoryCacheServiceCollectionExtensions Class

Definition

Extension methods for setting up memory cache related services in an IServiceCollection.

C#
public static class MemoryCacheServiceCollectionExtensions
Inheritance
MemoryCacheServiceCollectionExtensions

Methods

AddDistributedMemoryCache(IServiceCollection, Action<MemoryDistributedCacheOptions>)

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.

AddDistributedMemoryCache(IServiceCollection)

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.

AddMemoryCache(IServiceCollection, Action<MemoryCacheOptions>)

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

AddMemoryCache(IServiceCollection)

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

Applies to

Product Versions
.NET 8 (package-provided), 9 (package-provided)
.NET Framework 4.7 (package-provided), 4.7.1 (package-provided), 4.7.2 (package-provided), 4.8 (package-provided)
.NET Standard 2.0 (package-provided)