From f39052a7a89a6bf18a195b9815cf899ccd1debeb Mon Sep 17 00:00:00 2001 From: apptaro Date: Tue, 5 Dec 2017 13:14:22 +0900 Subject: [PATCH] Fix for Issue #54 --- .../src/main/java/org/ehcache/jcache/JCacheManager.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/ehcache-jcache/src/main/java/org/ehcache/jcache/JCacheManager.java b/ehcache-jcache/src/main/java/org/ehcache/jcache/JCacheManager.java index 5792955..3e0d007 100644 --- a/ehcache-jcache/src/main/java/org/ehcache/jcache/JCacheManager.java +++ b/ehcache-jcache/src/main/java/org/ehcache/jcache/JCacheManager.java @@ -71,7 +71,7 @@ public JCacheManager(final JCacheCachingProvider jCacheCachingProvider, final Ca this.cacheManager = cacheManager; this.uri = uri; this.props = props; - refreshAllCaches(); + //refreshAllCaches(); } @Override @@ -161,7 +161,11 @@ public Cache getCache(final String cacheName, final Class keyTyp public Cache getCache(final String cacheName) { final JCache jCache = allCaches.get(cacheName); if(jCache == null) { - refreshAllCaches(); + //refreshAllCaches(); + final net.sf.ehcache.Cache cache = cacheManager.getCache(cacheName); + if (cache != null) { + allCaches.put(cacheName, new JCache(this, new JCacheConfiguration(cache.getCacheConfiguration()), cache)); + } return allCaches.get(cacheName); } if(jCache.getConfiguration(CompleteConfiguration.class).getKeyType() != Object.class ||