• Bug
  • Status: Closed
  • 2 Major
  • Resolution: Duplicate
  • ehcache
  • cdennis
  • Reporter: scranth
  • October 26, 2009
  • 0
  • Watchers: 0
  • November 19, 2009
  • November 03, 2009


I wrote a page to display a list of caches as well as information about each cache. I wanted to display the hit/miss count for each cache by using cache.getStatistics().getCachHits() and cache.getStatistics().getCachMisses(). However I am noticing that the hit and miss counts are staying the same for all of the hibernate entiy caches.

If I do not explicitly define a element for each hibernate entity, the statistics are not working correctly. Once I define a element for each entity, the statistics work fine.

The stats start out at 0 when I start the jvm. As I run test queries, they all being to increase, for example, from 0 –> 3 –> 29 –> 45, etc.

Very strange because if I attache the Ehcache1.6.2 sources and debug Cache or Statistics I can see that those caches actually do all have the same values for hits and misses. So it appears that when one cache’s stats are upated then the others get update also.

My configuration is Hibernate 2nd level/query cache+Spring+Ehcache1.6.2.

<?xml version=”1.0” encoding=”UTF-8”?>


Chris Dennis 2009-11-03

The version of the bug that Andy is seeing was removed when Abhishek (asingh) reworked the stats code for 1.7. In his rework he introduced another bug in the clone implementation that had the same symptoms. This was eventually spotted (due to a dup of this JIRA) prior to the release of 1.7, and was fixed in revision 1238 (EHC-357).