namespace Admin.NET.Core; public static class CacheSetup { /// /// 缓存注册(新生命Redis组件) /// /// public static void AddCache(this IServiceCollection services) { ICache cache = Cache.Default; var cacheOptions = App.GetOptions(); if (cacheOptions.CacheType == CacheTypeEnum.Redis.ToString()) { var redis = new FullRedis(); redis.Init(cacheOptions.RedisConnectionString); cache = redis; } services.AddSingleton(cache); } }