如果我有以下配置:
- <defaultCache timeToIdleSeconds="120"
- timeToLiveSeconds="120" />
- <cache name="test"
- timeToLiveSeconds="300" />
timeToIdleSeconds的高速缓存测试值是多少?它将从默认缓存继承,因此等于120,否则将取为手册中给出的默认值,即0(无穷大)?
timeToIdleSeconds将是默认值,而不是从“defaultCache”继承. “defaultCache”有点不正确/误导,在某种意义上说,它不为每个缓存提供“默认值”,但它只是为可以动态添加的缓存指定配置的方式 – 使用cacheManager.addCache(String cacheName ).
从http://www.ehcache.org/ehcache.xml起,该标签的文档读取
- 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.