我们在其中一个应用程序中使用Hibernate Search 3.4.2最终版和EHCACHE 2.3.1。Hibernate Search索引的数据是只读的。出于性能原因,我们将完整的数据加载到二级缓存中。
有一段时间,一些意外发生的事情清除了整个二级缓存。这肯定不是由我们的代码显式触发的东西。
有没有人有这样的想法?在回滚事务中使用Hibernate搜索是否有可能导致这种行为?
Edit1:
这是我们的EHCACHE配置:
<ehcache updateCheck="false">
<diskStore path="java.io.tmpdir/ds42" />
<defaultCache maxElementsInMemory="200000" eternal="true"
statistics="true" overflowToDisk="true" diskPersistent="false"
diskExpiryThreadIntervalSeconds="3600" memoryStoreEvictionPolicy="LRU"/>
</ehcache>发布于 2016-02-20 02:51:06
这种“令人惊讶的”行为的答案可以在this article中找到。
添加
query.unwrap(org.hibernate.SQLQuery.class).addSynchronizedQuerySpace("");以防止Hibernate清除二级缓存。
https://stackoverflow.com/questions/35344243
复制相似问题