/** * Create the known caches again with the current state of this manager. */ private void refreshKnownCaches() { for (Map.Entry<String, Cache> entry : this.cacheMap.entrySet()) { entry.setValue(createCaffeineCache(entry.getKey())); } }
/** * Specify the set of cache names for this CacheManager's 'static' mode. * <p>The number of caches and their names will be fixed after a call to this method, * with no creation of further cache regions at runtime. * <p>Calling this with a {@code null} collection argument resets the * mode to 'dynamic', allowing for further creation of caches again. */ public void setCacheNames(@Nullable Collection<String> cacheNames) { if (cacheNames != null) { for (String name : cacheNames) { this.cacheMap.put(name, createCaffeineCache(name)); } this.dynamic = false; } else { this.dynamic = true; } }
@Override @Nullable public Cache getCache(String name) { Cache cache = this.cacheMap.get(name); if (cache == null && this.dynamic) { synchronized (this.cacheMap) { cache = this.cacheMap.get(name); if (cache == null) { cache = createCaffeineCache(name); this.cacheMap.put(name, cache); } } } return cache; }
/** * Create the known caches again with the current state of this manager. */ private void refreshKnownCaches() { for (Map.Entry<String, Cache> entry : this.cacheMap.entrySet()) { entry.setValue(createCaffeineCache(entry.getKey())); } }
/** * Specify the set of cache names for this CacheManager's 'static' mode. * <p>The number of caches and their names will be fixed after a call to this method, * with no creation of further cache regions at runtime. * <p>Calling this with a {@code null} collection argument resets the * mode to 'dynamic', allowing for further creation of caches again. */ public void setCacheNames(@Nullable Collection<String> cacheNames) { if (cacheNames != null) { for (String name : cacheNames) { this.cacheMap.put(name, createCaffeineCache(name)); } this.dynamic = false; } else { this.dynamic = true; } }
@Override @Nullable public Cache getCache(String name) { Cache cache = this.cacheMap.get(name); if (cache == null && this.dynamic) { synchronized (this.cacheMap) { cache = this.cacheMap.get(name); if (cache == null) { cache = createCaffeineCache(name); this.cacheMap.put(name, cache); } } } return cache; }
/** * Create the known caches again with the current state of this manager. */ private void refreshKnownCaches() { for (Map.Entry<String, Cache> entry : this.cacheMap.entrySet()) { entry.setValue(createCaffeineCache(entry.getKey())); } }
/** * Specify the set of cache names for this CacheManager's 'static' mode. * <p>The number of caches and their names will be fixed after a call to this method, * with no creation of further cache regions at runtime. * <p>Calling this with a {@code null} collection argument resets the * mode to 'dynamic', allowing for further creation of caches again. */ public void setCacheNames(Collection<String> cacheNames) { if (cacheNames != null) { for (String name : cacheNames) { this.cacheMap.put(name, createCaffeineCache(name)); } this.dynamic = false; } else { this.dynamic = true; } }
@Override public Cache getCache(String name) { Cache cache = this.cacheMap.get(name); if (cache == null && this.dynamic) { synchronized (this.cacheMap) { cache = this.cacheMap.get(name); if (cache == null) { cache = createCaffeineCache(name); this.cacheMap.put(name, cache); } } } return cache; }