简体   繁体   中英

Monitoring Enterprise Library caching

I want to monitor the key names and values that are being stored by my application in the Enterprise Library caching mechanism.

We're using the in memory settings. Basically, I just need to figure out how to dump the keys that are currently stored.

I see that the ICacheManager returns an object that has a counter, but there doesn't appear to be a way to access the cached items unless you already know the key.

Ideas?

You are correct - Enterprise Lib does not expose the in memory Cache of the CashManager. But... there is always a work around. You can reference the downloaded sourced as a project modify the original CacheManager to expose the instance of cache which has a property called CurrentCacheState and is a mere hashtable. Then you would do the usual foreach:

    foreach(DictionaryEntry d in myExposedCacheManager.RealCache.CurrentCacheState) 
    {

         Console.WriteLine(d.Key.ToString(), d.Value.ToString();
    }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM