views:

96

answers:

0

I think my Hibernate (3.5.3) Second Level Cache is well configured with EhCache (2.2).

At least, I observe following log entries:

20:15:28 DEBUG [net.sf.ehcache.Cache#searchInStoreWithStats] persistence.unit:unitName=#pu-pay.c.u.p.model.ActionCache: persistence.unit:unitName=#pu-pay.c.u.p.model.Action store hit for c.u.p.model.Action#TRT    
20:15:28 DEBUG [net.sf.ehcache.Cache#searchInStoreWithStats] persistence.unit:unitName=#pu-pay.c.u.p.model.ActionCache: persistence.unit:unitName=#pu-pay.c.u.p.model.Action store hit for c.u.p.model.Action#PID

(... do these "store hits" really indicate that the cache is working?)

What puzzles me now is:

When I inspect the statistics as follows:

cacheManager.getCache("persistence.unit:unitName=#pu-pay.c.u.p.model.Action").getStatistics().toString()

... all I see is:

 name = persistence.unit:unitName=#pu-pay.c.u.p.model.Action cacheHits = 0 onDiskHits = 0 inMemoryHits = 0 misses = 0 size = 0 averageGetTime = 0.0 evictionCount = 0

... no hits, no misses,... nothing...

In ehcache.xml, I have:

   <defaultCache
        ...
        statistics="true"
        ...
        />

   <cache
        name="persistence.unit:unitName=#pu-pay.c.u.p.model.Action"
        maxElementsInMemory="100"
        eternal="true"
        timeToIdleSeconds="300"
        timeToLiveSeconds="600"
        overflowToDisk="false"
        statistics="true"
        />

Does this ring a bell to any body? Do I have to enable statistics in another location as well? ...