ehcache.xml中的缓存是否从defaultCache继承?
发布时间:2020-12-16 07:52:13 所属栏目:百科 来源:网络整理
导读:如果我有以下配置: defaultCache timeToIdleSeconds="120" timeToLiveSeconds="120" /cache name="test" timeToLiveSeconds="300" / timeToIdleSeconds的高速缓存测试值是多少?它将从默认缓存继承,因此等于120,否则将取为手册中给出的默认值,即0(无穷大)?
如果我有以下配置:
<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. (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |