首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >defaultCache的Ehcache?

defaultCache的Ehcache?
EN

Stack Overflow用户
提问于 2014-02-08 21:32:05
回答 1查看 2.7K关注 0票数 0

在我的项目中,我们使用ehcache进行二级缓存,我们还提到了<defaultCache>标记和一些<cache>属性。

ehcache.xml样品

代码语言:javascript
复制
<ehcache>
<defaultCache
     maxEntriesLocalHeap="10000"
     eternal="false"
     timeToIdleSeconds="120"
     timeToLiveSeconds="120"
     maxEntriesLocalDisk="10000000"
     diskExpiryThreadIntervalSeconds="120"
     memoryStoreEvictionPolicy="LRU"
  />

<cache name="com.test.First"
     maxEntriesLocalHeap="10000"
     eternal="false"
     timeToIdleSeconds="120"
     timeToLiveSeconds="120"
  />
<cache name="com.test.Second"
     maxEntriesLocalHeap="10000"
     eternal="false"
     timeToIdleSeconds="120"
     timeToLiveSeconds="120"
  />
</ehcache>

hibernate.cfg.xml样品

代码语言:javascript
复制
<class-cache class="com.test.First" usage="read-only"/>
<class-cache class="com.test.Second" usage="read-only"/>
<class-cache class="com.test.Third" usage="read-only"/>

在这里,我们为com.test.Third添加了com.test.Third标记,这在ehcache.xml文件中没有提到。

这个com.test.Third类也会使用defaultCache进行缓存吗?

EN

回答 1

Stack Overflow用户

发布于 2014-05-28 14:57:09

实际上,这种情况下是这样的,因为Hibernate将为您完成工作。但是,automatically.不是为创建缓存defaultCache而设计的。有关更多细节,请查看这个问题:Do caches in ehcache.xml inherit from defaultCache?和这个问题:EhCache default cache in java

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/21652059

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档