I'm using the cache provided by System.Runtime.Caching.MemoryCache
.
I'd like to enumerate over the cache's items so that I can invalidate (evict then reload) items as such
foreach (var item in MemoryCache.Default) { item.invalidate() }
But the official docs found here state:
!Important: Retrieving an enumerator for a MemoryCache instance is a resource-intensive and blocking operation. Therefore, the enumerator should not be used in production applications.
Surely there must be a simple and efficient way to iterate over the cache's items?