The suggestions made so far have been wonderful, but my need is still stated: for iterating over cache elements . It seems to be such a simple task, and I expect that inside the cache inside there is some sort of list structure. Requires documents and feature set for MemoryCache .
So, as discussed above, I added a list to the cache adapter class, which contains a link to every item that I put in the cache. If I need to iterate over the cache - not only for invalidity, but also for collecting statistics, etc. - then I iterate over my list.
If the number of items put in the cache does not change, this is a reasonable decision. If the number changes, you need to insert / delete through the adapter class to keep the list in sync with the actual cache. It is useless, but it works, and avoids the primary sanctions mentioned in the documents.
I hope that the caching provider MemoryCache will be hidden in the next release of the platform.
Peter Marks Nov 06 '11 at 10:51 2011-11-06 10:51
source share