@Override public void putAll(Map<? extends K, ? extends V> m) { cache.putAll(m); }
@Override public void putAll(Map<? extends K, ? extends V> m) { delegate.putAll(m); }
/** @since 12.0 */ @Override public void putAll(Map<? extends K, ? extends V> m) { delegate().putAll(m); }
/** @since 12.0 */ @Override public void putAll(Map<? extends K, ? extends V> m) { delegate().putAll(m); }
@Override public void putAll(Map<? extends K, ? extends V> map) { cache.putAll(map); }
/** @since 12.0 */ @Override public void putAll(Map<? extends K, ? extends V> m) { delegate().putAll(m); }
/** * {@inheritDoc}. * * <p> * If present in the cache, return the cached {@link com.typesafe.config.Config} for given input * Otherwise, simply delegate the functionality to the internal {ConfigStoreValueInspector} and store the value into cache * </p> */ @Override public Map<ConfigKeyPath, Config> getOwnConfigs(Collection<ConfigKeyPath> configKeys) { Collection<ConfigKeyPath> configKeysNotInCache = new ArrayList<>(); Map<ConfigKeyPath, Config> result = new HashMap<>(); for(ConfigKeyPath configKey: configKeys){ Config cachedValue = this.ownConfigCache.getIfPresent(configKey); if(cachedValue==null){ configKeysNotInCache.add(configKey); } else{ result.put(configKey, cachedValue); } } // for ConfigKeyPath which are not in cache if(configKeysNotInCache.size()>0){ Map<ConfigKeyPath, Config> configsFromFallBack = this.valueFallback.getOwnConfigs(configKeysNotInCache); this.ownConfigCache.putAll(configsFromFallBack); result.putAll(configsFromFallBack); } return result; }
public void testPutAll() { Cache<Integer, Integer> cache = CacheBuilder.newBuilder().build(); cache.putAll(ImmutableMap.of(10, 20, 30, 50, 60, 90)); assertEquals(Integer.valueOf(20), cache.getIfPresent(10)); assertEquals(Integer.valueOf(50), cache.getIfPresent(30)); assertEquals(Integer.valueOf(90), cache.getIfPresent(60)); cache.asMap().putAll(ImmutableMap.of(10, 50, 30, 20, 60, 70, 5, 5)); assertEquals(Integer.valueOf(50), cache.getIfPresent(10)); assertEquals(Integer.valueOf(20), cache.getIfPresent(30)); assertEquals(Integer.valueOf(70), cache.getIfPresent(60)); assertEquals(Integer.valueOf(5), cache.getIfPresent(5)); }
this.recursiveConfigCache.putAll(configsFromFallBack); result.putAll(configsFromFallBack);
@VisibleForTesting void loadRecording() throws IOException { Recording recording = new ObjectMapperProvider().get().readValue(new File(recordingPath), Recording.class); allDatabases = recording.getAllDatabases(); databaseCache.putAll(toMap(recording.getDatabases())); tableCache.putAll(toMap(recording.getTables())); supportedColumnStatisticsCache.putAll(toMap(recording.getSupportedColumnStatistics())); tableStatisticsCache.putAll(toMap(recording.getTableStatistics())); partitionStatisticsCache.putAll(toMap(recording.getPartitionStatistics())); allTablesCache.putAll(toMap(recording.getAllTables())); allViewsCache.putAll(toMap(recording.getAllViews())); partitionCache.putAll(toMap(recording.getPartitions())); partitionNamesCache.putAll(toMap(recording.getPartitionNames())); partitionNamesByPartsCache.putAll(toMap(recording.getPartitionNamesByParts())); partitionsByNamesCache.putAll(toMap(recording.getPartitionsByNames())); rolesCache.putAll(toMap(recording.getRoles())); databasePrivilegesCache.putAll(toMap(recording.getDatabasePrivileges())); tablePrivilegesCache.putAll(toMap(recording.getTablePrivileges())); }
public void testPutAll() { Cache<Integer, Integer> cache = CaffeinatedGuava.build(Caffeine.newBuilder()); cache.putAll(ImmutableMap.of(10, 20, 30, 50, 60, 90)); assertEquals(Integer.valueOf(20), cache.getIfPresent(10)); assertEquals(Integer.valueOf(50), cache.getIfPresent(30)); assertEquals(Integer.valueOf(90), cache.getIfPresent(60)); cache.asMap().putAll(ImmutableMap.of(10, 50, 30, 20, 60, 70, 5, 5)); assertEquals(Integer.valueOf(50), cache.getIfPresent(10)); assertEquals(Integer.valueOf(20), cache.getIfPresent(30)); assertEquals(Integer.valueOf(70), cache.getIfPresent(60)); assertEquals(Integer.valueOf(5), cache.getIfPresent(5)); }
cache.putAll(ImmutableMap.of(1, 1, 2, 2, 3, 3)); cache.invalidateAll(); Arrays.fill(stats, 0);
private static Cache<String,Long> getPopulatedFileLenCache(Path dir, List<FileStatus> statuses) { Map<String,Long> fileLens = getFileLenMap(statuses); Map<String,Long> absFileLens = new HashMap<>(); fileLens.forEach((k, v) -> { absFileLens.put(CachableBlockFile.pathToCacheId(new Path(dir, k)), v); }); Cache<String,Long> fileLenCache = CacheBuilder.newBuilder().build(); fileLenCache.putAll(absFileLens); return fileLenCache; }
/** * @since 12.0 */ @Override public void putAll(Map<? extends K, ? extends V> m) { delegate().putAll(m); }
@Override public void putAll(Map<? extends K, ? extends V> m) { memCacheMetadata.putAll(m.keySet()); memCache.putAll(m); }
/** * @since 12.0 */ @Override public void putAll(Map<? extends K,? extends V> m) { delegate().putAll(m); }
public synchronized void setExpireAfter(long duration, TimeUnit unit) { this.expireAfterNanos = unit.toNanos(duration); Cache<NodeId, Map<AttributeId, DataValue>> newCache = buildCache(); newCache.putAll(cache.asMap()); cache = newCache; }
public synchronized void setMaximumSize(long maximumSize) { this.maximumSize = maximumSize; Cache<NodeId, Map<AttributeId, DataValue>> newCache = buildCache(); newCache.putAll(cache.asMap()); cache = newCache; }
/** * @since 12.0 */ @Override public void putAll(Map<? extends K,? extends V> m) { delegate().putAll(m); }
/** @since 12.0 */ @Override public void putAll(Map<? extends K, ? extends V> m) { delegate().putAll(m); }