public static void AddRedis(this IServiceCollection services, Action <string, string> handle = null) { if (!ConnectionHelper.Redis.Any()) { return; } var cache = RedisProvider.Build(ConnectionHelper.Redis, handle); services.AddSingleton <IDistributedCache>(cache); }