当它与休眠第二级缓存一起使用时,我正在接收Eh缓存日志记录输出 - 我不理解输出及其可能意味着什么。它被大量打印到日志上。
DEBUG [net.sf.ehcache.store.disk.Segment] put added 0 on heap
DEBUG [net.sf.ehcache.store.disk.Segment] put updated, deleted 0 on heap
谁能阐明这可能意味着什么?根据统计数据的打印,我的二级缓存似乎正在工作......
INFO [com.atlaschase.falcon.commands.domain.AircraftCommandResolutionService] [ name = aircraftCache cacheHits = 824 onDiskHits = 0 offHeapHits = 0 inMemoryHits = 824 misses = 182 onDiskMisses = 182 offHeapMisses = 0 inMemoryMisses = 182 size = 91 averageGetTime = 1.0745527 evictionCount = 0 ]
任何帮助将不胜感激..
西蒙
此输出由 DiskStore 生成,IIRC 在 EhCache 中默认启用。基本上,EhCache将缓存的数据从内存溢出到磁盘。如果要禁用此功能,请将overflowToDisk
属性设置为 flase
:
<cache name="..." overflowToDisk="false"
哦 - 有人也可以确认"平均获取时间"是以毫秒为单位而不是秒吗?
确认,毫秒。虽然Statistics.getAverageGetTime()
的JavaDoc有点令人困惑:
[...]因为 ehcache 支持 JDK1.4.2,所以每个获取时间都使用 System.currentTimeMilis,而不是纳秒。因此,准确性是有限的。
我在LiveCacheStatisticsImpl
中找到了以下代码:
public float getAverageGetTimeMillis() {
//...
return (float) totalGetTimeTakenMillis.get() / hitCount;
}