If I have the following configuration:
<defaultCache timeToIdleSeconds="120"
timeToLiveSeconds="120" />
<cache name="test"
timeToLiveSeconds="300" />
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)?
In this article, we will introduce Ehcache, a widely used, open-source Java-based cache. It features memory and disk stores, listeners, cache loaders, RESTful and SOAP APIs and other very useful features.
xml is included in the Ehcache distribution and can also be downloaded from http://ehcache.org/ehcache.xml. It contains comments to help you configure each element. Note that some elements documented in the sample Ehcache XML file pertain only to BigMemory and are not valid for the open-source version of Ehcache.
Open-source Ehcache offers a limited version of persistence, as noted in this document. Fast Restart provides enterprise-ready crash resilience with an option to store a fully consistent copy of the cache on the local disk at all times.
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).
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With