2012-06-07 8 views
13

अगर मैं निम्नलिखित विन्यास है:ehcache.xml में कैश डिफ़ॉल्ट कैश से प्राप्त करते हैं?

<defaultCache timeToIdleSeconds="120" 
     timeToLiveSeconds="120" /> 
<cache name="test" 
     timeToLiveSeconds="300" /> 

क्या कैश test के लिए timeToIdleSeconds का मूल्य क्या होगा? क्या इसे डिफ़ॉल्ट कैश से विरासत में प्राप्त किया जाएगा, और इस प्रकार 120 के बराबर होगा, या मैन्युअल में दिए गए डिफ़ॉल्ट मान को ले जाएगा, जो 0 (अनंतता) है?

उत्तर

14

TimeToIdleSeconds डिफ़ॉल्ट मान होगा और "डिफ़ॉल्ट कैश" से प्राप्त नहीं होगा। "डिफ़ॉल्ट कैश" थोड़ा गलत नामक/भ्रामक है, इस अर्थ में कि यह प्रत्येक कैश के लिए "डिफ़ॉल्ट" प्रदान नहीं करता है, लेकिन यह कैश के लिए कॉन्फ़िगर निर्दिष्ट करने का एक तरीका है जो गतिशील रूप से जोड़ा जा सकता है - cacheManager.addCache (स्ट्रिंग कैशनाम)।

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. 
+0

मुझे लगता है कि पाठ पढ़ा लिखा है, लेकिन मेरे लिए यह बहुत स्पष्ट होना प्रतीत नहीं होता। –

+0

FYI, 'डिफ़ॉल्ट कैश' सेटिंग्स का उपयोग तब भी किया जाता है जब 'कैशमेनगर # addCacheIfAbsent (स्ट्रिंग कैशनाम)' कॉल किया जाता है। –

संबंधित मुद्दे