public static void CacheManagerOnOnRemove(CacheEventArgs args, ICacheManager cache) { // TODO: implement IEnumerable on cache manager using (var existingKeys = InMemoryCacheManager.Entries.GetEnumerator()) { var entriesToRemove = new List <string>(); while (existingKeys.MoveNext()) { var key = CacheKeyHelper.GetResourceKeyFromCacheKey(existingKeys.Current.Key); var containerName = GetContainerName(key); if (containerName != null && args.ResourceKey.StartsWith(containerName)) { entriesToRemove.Add(existingKeys.Current.Key); } } foreach (var entry in entriesToRemove) { cache.Remove(entry); } } }