using Microsoft.Extensions.Caching.Memory;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Options;
using System;
using WIDESEA_Core.Caches;
namespace WIDESEA_Core.Extensions
{
///
/// Memory缓存 启动服务
///
public static class MemoryCacheSetup
{
///
/// 添加内存缓存配置到服务集合
///
/// 服务集合
/// 当services为null时抛出
public static void AddMemoryCacheSetup(this IServiceCollection services)
{
if (services == null) throw new ArgumentNullException(nameof(services));
services.AddSingleton();
services.AddMemoryCache();
}
}
}