public static void UseRedisCaching(this IServiceCollection serviceCollection, IEnumerable <string> hosts, uint dataBase) { serviceCollection.AddSingleton(RedisConnectionFactory.BuildConnectionMultiplexer(hosts)); serviceCollection.AddTransient <ICacheStore>(sp => new RedisCacheStore(sp.GetService <IConnectionMultiplexer>(), (int)dataBase)); serviceCollection.AddTransient <ICacheService, CacheService>(); }