MemoryCacheServiceCollectionExtensions.AddMemoryCache 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
重载
AddMemoryCache(IServiceCollection) |
向 IServiceCollection 中添加 IMemoryCache 的非分布式内存中实现。 |
AddMemoryCache(IServiceCollection, Action<MemoryCacheOptions>) |
向 IServiceCollection 中添加 IMemoryCache 的非分布式内存中实现。 |
AddMemoryCache(IServiceCollection)
向 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>)
向 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>
用于配置所提供的 MemoryCacheOptions 的 Action<T>。
返回
IServiceCollection,以便可以链接其他调用。