Search code examples
c#enterprise-library

Monitor Enterprise Library Cache


I want to monitor my Enterprize Libray Cache for memory cosumption, keys and values. I searched stackoverflow and got a near answer. But I don't understand how can I do:

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.

Any Ideas?


Solution

  • Try this

    ICacheManager manager = EnterpriseLibraryContainer.Current.GetInstance<ICacheManager>("your cache name");
    Cache cache = EnterpriseLibraryContainer.Current.GetInstance<Cache>("your cache name");
    

    You can then do stuff with

    cache.CurrentCacheState