if(cache != null) newCache.putAll(cache.asMap()); final Cache<String, T> currentCache = this.cache; this.cache = newCache;
public void warmCacheWith(Map<TableReference, ConflictHandler> preload) { cache.putAll(preload); }
public void warmCacheWith(Map<TableReference, ConflictHandler> preload) { cache.putAll(preload); }
@Override public void putAll(Map<? extends K, ? extends V> m) { cache.putAll(m); }
@Override public void putAll(Map<? extends K, ? extends V> m) { cache.putAll(m); }
@Override public void putAll(Map<? extends K, ? extends V> m) { cache.putAll(m); }
@Override public void putAll(Map<? extends K, ? extends V> m) { underlyingCache.putAll(m); }
public void preload(final Map<C, String> idLabelMap) { labelCache.putAll(idLabelMap); }
public void putAll(Map<? extends StorableKey, ? extends Storable> map) { guavaCache.putAll(map); }
public void putAll(Map<? extends StorableKey, ? extends Storable> map) { guavaCache.putAll(map); }
public Counters( ConcurrentMap<String, DependencyType> roots, Map<String, Counter> counters) { mRoots = roots; mReferenceCounters = CacheBuilder.newBuilder() // TODO: set concurrency level? .build(new CacheLoader<String, Counter>() { @Override public Counter load(@NonNull String unused) throws Exception { return new Counter(); } }); mReferenceCounters.putAll(counters); } }
/** * Resets the cache to the given set of images. * <p> * This method is called when the memoized image supplier is reloaded, or * when the cache needs to be refreshed (for example when the TempalteBuilder * is invoked forcing a fresh image lookup. */ public void reset(Set<? extends Image> images) { imageCache.invalidateAll(); imageCache.putAll(Maps.uniqueIndex(images, new Function<Image, String>() { @Override public String apply(Image input) { return input.getId(); } })); }
/** * Resets the cache to the given set of images. * <p> * This method is called when the memoized image supplier is reloaded, or * when the cache needs to be refreshed (for example when the TempalteBuilder * is invoked forcing a fresh image lookup. */ public void reset(Set<? extends Image> images) { imageCache.invalidateAll(); imageCache.putAll(Maps.uniqueIndex(images, new Function<Image, String>() { @Override public String apply(Image input) { return input.getId(); } })); }
public void putAll(Collection<GHPullRequest> prs) { cache.putAll(prs.stream().collect(Collectors.toMap(GHPullRequest::getUrl, Function.identity()))); } }
@Override public Map<String, T> lookup(Set<String> keys) { ImmutableMap<String, T> cached = cache.getAllPresent(keys); Set<String> missingKeys = Sets.difference(keys, cached.keySet()); Map<String, T> missing = delegate.lookup(missingKeys); cache.putAll(missing); return ImmutableMap.<String, T>builder() .putAll(cached) .putAll(missing) .build(); } }
@Override public Map<String, StorageSpec> getAllStorageSpecs() { try { Map<String, StorageSpec> result = coreService.getAllStorageSpecs(); storageSpecCache.putAll(result); return result; } catch (Exception e) { log.error("Error while retrieving storage spec: {}", e); throw new SpecRetrievalException("Error while retrieving storage spec", e); } }
@Override public Map<String, EntitySpec> getAllEntitySpecs() { try { Map<String, EntitySpec> result = coreService.getAllEntitySpecs(); entitySpecCache.putAll(result); return result; } catch (Exception e) { log.error("Error while retrieving entity spec: {}", e); throw new SpecRetrievalException("Error while retrieving entity spec", e); } }
@Override public Map<String, FeatureSpec> getAllFeatureSpecs() { try { Map<String, FeatureSpec> result = coreService.getAllFeatureSpecs(); featureSpecCache.putAll(result); return result; } catch (Exception e) { log.error("Error while retrieving feature spec: {}", e); throw new SpecRetrievalException("Error while retrieving feature spec", e); } }
cache.get().putAll(Map.class.cast(imageMap)); logger.debug("<< images(%d)", imageMap.size());
newcache.putAll(existing.asMap()); return newcache;