... more EntLib goodness ...
I love Microsoft's Enterprise Library . I implemented a basic caching framework in our app at work some time ago using their Caching Application Block.
Today it was decided we needed to take it one step further so that it should monitor cache stats such as hit ratio, object count etc and adjust the expiration policies accordingly.
Seemed like a lot of work .... until I found out that EntLib creates a number of performance counters that can be queried using WMI. So I tried it out and it works like a charm !
You can monitor stats for the Caching Block in real-time using the Performance monitoring app in Windows, or query the data programmatically from WMI.