【发布时间】:2012-09-13 12:37:53
【问题描述】:
我已经为 EHCache 配置了 defaultCache(用于元素)、StandardQueryCache(用于查询)和 UpdateTimestampsCache(我认为它是为了跟踪数据库更新......但我并没有真正了解它究竟做了什么)。
我已经为这些缓存中的每一个设置了 maxElementsInMemory,但我没有得到这个数字控制 StandardQueryCache 和 UpdateTimestampsCache 的内容。我知道默认缓存中可以缓存的实体数量不能超过10000,但是查询缓存不缓存元素。它缓存主键(据我所知)。
这是否意味着 StandardQueryCache 的 maxElementsInMemory 控制结果中的“行”数,或者它是否控制它可能具有的元素的主键对数?
UpdateTimestampsCache 怎么样?它是否会跟踪上次更新实体的时间、上次更新表的时间……或其他什么?我应该为这个 maxElementsInMemory 使用什么数字?
谢谢!
<ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="ehcache.xsd" updateCheck="true" monitoring="autodetect" dynamicConfig="true">
<defaultCache
maxElementsInMemory="10000"
eternal="false"
timeToIdleSeconds="3600"
timeToLiveSeconds="3600">
</defaultCache>
<cache
name="org.hibernate.cache.internal.StandardQueryCache"
maxElementsInMemory="10000"
eternal="false"
timeToIdleSeconds="3600"
timeToLiveSeconds="3600">
</cache>
<cache
name="org.hibernate.cache.spi.UpdateTimestampsCache"
maxElementsInMemory="10000"
eternal="true">
</cache>
</ehcache>
【问题讨论】:
标签: hibernate configuration ehcache