reta commented on code in PR #3696:
URL: https://github.com/apache/cxf/pull/3696#discussion_r4512492099


##########
rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/common/jcache/JCacheTokenReplayCache.java:
##########
@@ -99,19 +106,29 @@ protected JCacheTokenReplayCache(String cacheKey, String 
configFile, String defa
             ? resolvedConfigFileURL.toURI() : cachingProvider.getDefaultURI();
         cacheManager = cachingProvider.getCacheManager(configURI, 
getClass().getClassLoader());
 
-        cache = getOrCreate(cacheManager, cacheKey, String.class, 
EHCacheValue.class);
-    }
-
-    private static <K, V> Cache<K, V> getOrCreate(CacheManager cacheManager, 
String name,
-            Class<K> kclass, Class<V> vclass) {
+        Cache<String, EHCacheValue> configuredCache =
+            cacheManager.getCache(cacheKey, String.class, EHCacheValue.class);
+        cache = configuredCache != null ? configuredCache : 
createCache(cacheManager, cacheKey);
 
-        final Cache<K, V> cache = cacheManager.getCache(name, kclass, vclass);
-        if (cache != null) {
-            return cache;
-        }
+        // With the default configuration, the cache uses EHCacheExpiry, which 
holds an entry for at most

Review Comment:
   I believe we could find out the expiration from the cache (default or not):
   
   ```
           final CompleteConfiguration<?, ?> configuration = 
cache.getConfiguration(CompleteConfiguration.class);
           final ExpiryPolicy policy = 
configuration.getExpiryPolicyFactory().create();
           // Use policy.getExpiryForXxx() methods
   
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to