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

查看:542
本文介绍了ehcache.xml中的缓存是否继承自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 http://www.ehcache.org/ehcache.xml, 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.

这篇关于ehcache.xml中的缓存是否继承自defaultCache?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆