LocalCacheStore implements CacheStore { @Override public boolean delete(String... keys) { logger.debug("delete, keys={}", new ArrayLogParam(keys)); boolean deleted = false; for (String key : keys) { CacheItem<?> previous = caches.remove(key); if (!deleted && previous != null) deleted = true; } return deleted; }  @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 delete() { cacheStore.put("key1", new TestCache(), Duration.ofMinutes(1), null); cacheStore.put("key2", new TestCache(), Duration.ofMinutes(1), null); assertThat(cacheStore.delete("key1", "key2")).isTrue(); assertThat(cacheStore.caches).isEmpty(); assertThat(cacheStore.delete("key1", "key2")).isFalse(); }