LocalCacheStore implements CacheStore { @Override public <T> T get(String key, CacheContext<T> context) { logger.debug("get, key={}", key); return get(key, System.currentTimeMillis()); }  @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 get() { var value = new TestCache(); cacheStore.put("key1", value, Duration.ofMinutes(1), null); TestCache retrievedValue = cacheStore.get("key1", null); assertThat(retrievedValue).isSameAs(value); LocalCacheStore.CacheItem<?> item = cacheStore.caches.get("key1"); assertThat(item.hits).isEqualTo(1); cacheStore.get("key1", null); assertThat(item.hits).isEqualTo(2); }