MemoryCacheServiceCollectionExtensions.AddMemoryCache 方法
定义
重载
| AddMemoryCache(IServiceCollection) |
向 IServiceCollection 中添加 IMemoryCache 的非分布式内存中实现。Adds a non distributed in memory implementation of IMemoryCache to the IServiceCollection. |
| AddMemoryCache(IServiceCollection, Action<MemoryCacheOptions>) |
向 IServiceCollection 中添加 IMemoryCache 的非分布式内存中实现。Adds a non distributed in memory implementation of IMemoryCache to the IServiceCollection. |
AddMemoryCache(IServiceCollection)
向 IServiceCollection 中添加 IMemoryCache 的非分布式内存中实现。Adds a non distributed in memory implementation of IMemoryCache to the IServiceCollection.
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。The IServiceCollection to add services to.
返回
IServiceCollection,以便可以链接其他调用。The IServiceCollection so that additional calls can be chained.
适用于
AddMemoryCache(IServiceCollection, Action<MemoryCacheOptions>)
向 IServiceCollection 中添加 IMemoryCache 的非分布式内存中实现。Adds a non distributed in memory implementation of IMemoryCache to the IServiceCollection.
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。The IServiceCollection to add services to.
- setupAction
- Action<MemoryCacheOptions>
用于配置所提供的 MemoryCacheOptions 的 Action<T>。The Action<T> to configure the provided MemoryCacheOptions.
返回
IServiceCollection,以便可以链接其他调用。The IServiceCollection so that additional calls can be chained.