using System.Linq; using System.Threading.Tasks; namespace IStation { internal sealed partial class SharedMemoryCache { /// /// Flush will remove all cache entries, but not block any set operations /// public void Flush() { if (_isWiping) { return; } var keys = _memoryCache.Select(x => x.Key); Parallel.ForEach(keys, x => ((IMemoryCacheDirect)this).Remove(x)); } } }