Ehcache统计数据未显示命中/小姐计数

时间:2015-04-28 14:56:52

标签: hibernate ehcache

我有一个分布式EHcache设置,我通过JMX公开了Ehcache统计信息以进行调试。 在启动应用程序时,我设置了这些配置参数:

CacheManager.getInstance().getCache(s).getCacheConfiguration().setTimeToLiveSeconds(timeToLive);
CacheManager.getInstance().getCache(s).getCacheConfiguration().setStatistics(enable);

它们将在日志中设置为我的打印缓存配置,并显示正确的值。 但问题是JMX donot中显示的统计数据有关于总命中和未命中的任何信息。它只包含缓存中正确的对象计数。

如果我启用了Hibernate staistics,我可以正常看到所有第二级命中和错过。

我错过了任何设置吗?

1 个答案:

答案 0 :(得分:0)

对此进行了一些分析,结果如下:

  1. CacheConfiguration.setStatistics()ping已被弃用。 [http://ehcache.org/apidocs/2.8.4/net/sf/ehcache/config/CacheConfiguration.html]。可能这解释了为什么这些调用没有启用统计数据。

  2. 在ehcache.xml中设置statistics参数可解决此问题。

相关问题