public void Dispose() { var subClients = this.cacheSubClients.Values.ToList(); this.cacheSubClients = new ConcurrentDictionary <string, RedisClient>(); foreach (var redisClient in subClients) { redisClient.Dispose(); } generalInvalidationRedisClient?.Dispose(); this.cacheCallbacks = new ConcurrentDictionary <string, Func <CacheItemNotification, bool> >(); }