@Override
  public T computeIfAbsent(String key, Function<String, T> supplier) {
    return cache.compute(
        key,
        (String k, T current) -> {
          if (isValidLongEnough(current)) {
            return current;
          }
          return supplier.apply(key);
        });
  }
@Test
  void onlyFetchedOnce() {
    var clock = new MockClock();
    var ttl = Duration.ofSeconds(10);

    var sut = new InMemoryCacheImpl<CacheEntry>(clock, ttl);

    var now = Instant.parse("2024-01-01T13:11:00.000Z");
    clock.set(now);

    var key = "1";
    var e1 = CacheEntry.of(key, now.plusSeconds(60));

    var source = spy(Map.ofEntries(Map.entry(e1.value(), e1)));

    // when
    for (int i = 0; i < 4; i++) {
      var r = sut.computeIfAbsent(key, source::get);
      assertEquals(key, r.value());
    }

    // then
    verify(source, times(1)).get(key);
  }