using NewLife.Caching; namespace Cis.Core; public static class CacheSetup { /// /// 缓存注册(新生命Redis组件) /// /// public static void AddCache(this IServiceCollection services) { services.AddSingleton(options => { var cacheOptions = App.GetOptions(); if (cacheOptions.CacheType == CacheTypeEnum.Redis.ToString()) { var redis = new Redis(); redis.Init(cacheOptions.RedisConnectionString); return redis; } else { return Cache.Default; } }); } }