public <K, V> Cache<K, V> getCache(final String name) throws CacheException { log.trace("Acquiring EhcacheShiro instance named [{}]", name); org.ehcache.Cache<Object, Object> cache = getCacheManager().getCache(name, Object.class, Object.class); if (cache == null) { synchronized (shiroCacheLock) { cache = getCacheManager().getCache(name, Object.class, Object.class); if (cache == null) { log.info("Cache with name {} does not yet exist. Creating now.", name); ehcacheShiroManagerProvider.createCache(eh107CacheManager, name, Object.class, Object.class); cache = getCacheManager().getCache(name, Object.class, Object.class); log.info("Added EhcacheShiro named [{}]", name); } else { log.info("Using existing EhcacheShiro named [{}]", name); } } } else { log.info("Using existing EhcacheShiro named [{}]", name); } return new EhcacheShiro<K, V>(cache); } }
public <K, V> Cache<K, V> getCache(final String name) throws CacheException { log.trace("Acquiring EhcacheShiro instance named [{}]", name); org.ehcache.Cache<Object, Object> cache = getCacheManager().getCache(name, Object.class, Object.class); if (cache == null) { synchronized (shiroCacheLock) { cache = getCacheManager().getCache(name, Object.class, Object.class); if (cache == null) { log.info("Cache with name {} does not yet exist. Creating now.", name); ehcacheShiroManagerProvider.createCache(eh107CacheManager, name, Object.class, Object.class); cache = getCacheManager().getCache(name, Object.class, Object.class); log.info("Added EhcacheShiro named [{}]", name); } else { log.info("Using existing EhcacheShiro named [{}]", name); } } } else { log.info("Using existing EhcacheShiro named [{}]", name); } return new EhcacheShiro<K, V>(cache); } }