如果我有以下配置:
<defaultCache timeToIdleSeconds="120"
timeToLiveSeconds="120" />
<cache name="test"
timeToLiveSeconds="300" />
Run Code Online (Sandbox Code Playgroud)
timeToIdleSeconds
缓存的价值是test
什么?它是继承自默认缓存,因此等于120,还是采用手册中给出的默认值,即0(无穷大)?
小智 14
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.
归档时间: |
|
查看次数: |
5912 次 |
最近记录: |