MemoryCacheServiceCollectionExtensions.AddMemoryCache 方法

定义

重载

AddMemoryCache(IServiceCollection)

IServiceCollection 中添加 IMemoryCache 的非分布式内存中实现。

AddMemoryCache(IServiceCollection, Action<MemoryCacheOptions>)

IServiceCollection 中添加 IMemoryCache 的非分布式内存中实现。

AddMemoryCache(IServiceCollection)

Source:
MemoryCacheServiceCollectionExtensions.cs
Source:
MemoryCacheServiceCollectionExtensions.cs
Source:
MemoryCacheServiceCollectionExtensions.cs
Source:
MemoryCacheServiceCollectionExtensions.cs

IServiceCollection 中添加 IMemoryCache 的非分布式内存中实现。

public:
[System::Runtime::CompilerServices::Extension]
 static Microsoft::Extensions::DependencyInjection::IServiceCollection ^ AddMemoryCache(Microsoft::Extensions::DependencyInjection::IServiceCollection ^ services);
public static Microsoft.Extensions.DependencyInjection.IServiceCollection AddMemoryCache (this Microsoft.Extensions.DependencyInjection.IServiceCollection services);
static member AddMemoryCache : Microsoft.Extensions.DependencyInjection.IServiceCollection -> Microsoft.Extensions.DependencyInjection.IServiceCollection
<Extension()>
Public Function AddMemoryCache (services As IServiceCollection) As IServiceCollection

参数

services
IServiceCollection

要向其中添加服务的 IServiceCollection

返回

IServiceCollection,以便可以链接其他调用。

适用于

AddMemoryCache(IServiceCollection, Action<MemoryCacheOptions>)

Source:
MemoryCacheServiceCollectionExtensions.cs
Source:
MemoryCacheServiceCollectionExtensions.cs
Source:
MemoryCacheServiceCollectionExtensions.cs
Source:
MemoryCacheServiceCollectionExtensions.cs

IServiceCollection 中添加 IMemoryCache 的非分布式内存中实现。

public:
[System::Runtime::CompilerServices::Extension]
 static Microsoft::Extensions::DependencyInjection::IServiceCollection ^ AddMemoryCache(Microsoft::Extensions::DependencyInjection::IServiceCollection ^ services, Action<Microsoft::Extensions::Caching::Memory::MemoryCacheOptions ^> ^ setupAction);
public static Microsoft.Extensions.DependencyInjection.IServiceCollection AddMemoryCache (this Microsoft.Extensions.DependencyInjection.IServiceCollection services, Action<Microsoft.Extensions.Caching.Memory.MemoryCacheOptions> setupAction);
static member AddMemoryCache : Microsoft.Extensions.DependencyInjection.IServiceCollection * Action<Microsoft.Extensions.Caching.Memory.MemoryCacheOptions> -> Microsoft.Extensions.DependencyInjection.IServiceCollection
<Extension()>
Public Function AddMemoryCache (services As IServiceCollection, setupAction As Action(Of MemoryCacheOptions)) As IServiceCollection

参数

services
IServiceCollection

要向其中添加服务的 IServiceCollection

setupAction
Action<MemoryCacheOptions>

用于配置所提供的 MemoryCacheOptionsAction<T>

返回

IServiceCollection,以便可以链接其他调用。

适用于