【问题标题】:How to config QueryCache in ehcache.xml如何在 ehcache.xml 中配置 QueryCache
【发布时间】:2010-10-30 22:37:17
【问题描述】:

从我的sql日志文件来看,我认为QueryCache的物理属性是由元素配置的:

  <defaultCache
                maxElementsInMemory="0"
                eternal="false"
                timeToIdleSeconds="120"
                timeToLiveSeconds="120"
                overflowToDisk="false"
                memoryStoreEvictionPolicy="LRU"
                />

甚至我在 ehcache.xml 中添加了另一个元素,从 sql 日志看来,QueryCache 的物理属性仍然由 配置元素。

  <cache name="org.hibernate.cache.QueryCache"
                maxElementsInMemory="10000"
                eternal="false"
                timeToIdleSeconds="120"
                timeToLiveSeconds="120"
                overflowToDisk="false"
                memoryStoreEvictionPolicy="LRU"
        />

我只想在内存中启用 QueryCache,同时默认禁用其他(在内存中)。可能 元素的 name 属性不正确?我从书复制它。或者,我应该使用除 之外的其他元素吗?也许有某种元素?

谢谢。

【问题讨论】:

    标签: java xml hibernate ehcache second-level-cache


    【解决方案1】:

    尝试: name="org.hibernate.cache.StandardQueryCache"

    【讨论】:

    • 谢谢 OMax!它正在工作!我也将 放入 ehcache.xml 中。
    • 确保您没有将 UpdateTimestampsCache 设置为使元素过期,或者至少不要让它们比您的查询缓存更快地过期。这将导致查询结果不必要地无效。
    猜你喜欢
    • 1970-01-01
    • 2013-03-31
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2010-12-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多