ehcache - Hibernate second level cache: Hit and miss counts are always 0 -
i using hibernate 4.1.7 , ehcache second level cache
<property name="hibernate.cache.region.factory_class"> org.hibernate.cache.ehcache.ehcacheregionfactory</property> <property name="hibernate.cache.use_second_level_cache">true</property> <property name="hibernate.cache.use_query_cache">true</property>
when check miss count , hit count before , after db calls, 0.
long loadentitycount = hibernateutil.getsessionfactory().getstatistics().getsecondlevelcachestatistics("com.xys.program").getelementcountinmemory(); long hitcount = hibernateutil.getsessionfactory().getstatistics().getsecondlevelcachestatistics("com.xys.program").gethitcount(); long misscount = hibernateutil.getsessionfactory().getstatistics().getsecondlevelcachestatistics("com.xys.program").getmisscount();
list patientprograms = getprogramsforpatient( r);
loadentitycount = hibernateutil.getsessionfactory().getstatistics().getsecondlevelcachestatistics("com.xyz.program").getelementcountinmemory(); hitcount = hibernateutil.getsessionfactory().getstatistics().getsecondlevelcachestatistics("com.xyz.program").gethitcount(); misscount = hibernateutil.getsessionfactory().getstatistics().getsecondlevelcachestatistics("com.xyz.program").getmisscount();
i expecting non 0 values both cases , miss count goes up.
any help?
Comments
Post a Comment