监控企业库缓存

时间:2012-09-03 08:25:14

标签: c# enterprise-library

我想监视我的Enterprize Libray Cache以获取内存消耗,键和值。我搜索了stackoverflow并获得了near answer。但我不明白我该怎么做:

  

您可以引用下载的源代码作为项目修改原始CacheManager以公开具有名为CurrentCacheState的属性的缓存实例。

任何想法?

1 个答案:

答案 0 :(得分:0)

试试这个

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

然后你可以用

做事
cache.CurrentCacheState