LocalCacheStore implements CacheStore { @Override public <T> Map<String, T> getAll(String[] keys, CacheContext<T> context) { logger.debug("getAll, keys={}", new ArrayLogParam(keys)); long now = System.currentTimeMillis(); Map<String, T> results = Maps.newHashMapWithExpectedSize(keys.length); for (String key : keys) { T value = get(key, now); if (value != null) results.put(key, value); } return results; }  @Override T get(String key, CacheContext<T> context); @Override Map<String, T> getAll(String[] keys, CacheContext<T> context); @Override void put(String key, T value, Duration expiration, CacheContext<T> context); @Override void putAll(List<Entry<T>> values, Duration expiration, CacheContext<T> context); @Override boolean delete(String... keys); void cleanup(); void clear(); public int maxSize; }
@Test void getAll() { Map<String, TestCache> values = cacheStore.getAll(new String[]{"key1", "key2"}, null); assertThat(values).isEmpty(); var value = new TestCache(); cacheStore.put("key1", value, Duration.ofMinutes(1), null); values = cacheStore.getAll(new String[]{"key1", "key2"}, null); assertThat(values).hasSize(1).containsEntry("key1", value); }