ehcache.xml中的缓存是否继承自defaultCache? [英] Do caches in ehcache.xml inherit from defaultCache?




<defaultCache timeToIdleSeconds="120"
        timeToLiveSeconds="120" />
<cache name="test"
        timeToLiveSeconds="300" />

timeToIdleSeconds 的值是多少缓存 test ?它会从默认缓存中继承而来,因此等于120,还是采用手册中给出的默认值0(无穷大)?

What will be the value of timeToIdleSeconds for the cache test? Will it be inherited from the default cache, and thus be equal to 120, or will it take the default value as given in the manual, which is 0 (infinity)?


timeToIdleSeconds将是默认值,并且不会继承自 defaultCache。 defaultCache有点误称/误导,因为它不会为每个缓存提供默认值,而只是为可动态添加的缓存指定配置的一种方式-使用cacheManager.addCache(String cacheName )。

The timeToIdleSeconds will be default value and not inherit from "defaultCache". The "defaultCache" is a bit misnomer/misleading, in the sense that it does not provide "defaults" for every cache, but its just a way of specifying config for caches that can/are added dynamically - using cacheManager.addCache(String cacheName).

来自 http://www.ehcache .org / ehcache.xml ,该标签的文档读取

From, documentation for that tag reads

Default Cache configuration. 
These settings will be applied to caches created programmatically using
 CacheManager.add(String cacheName). This element is optional, and using
 CacheManager.add(String cacheName) when its not present will throw CacheException
 The defaultCache has an implicit name "default" which is a reserved cache name.


登录 关闭
发送“验证码”获取 | 15天全站免登陆