  default CompletableFuture<V> refresh(K key) {
    requireNonNull(key);

    var startTime = new long[1];
    @SuppressWarnings({"unchecked", "Varifier"})
    @Nullable V[] oldValue = (V[]) new Object[1];
    @SuppressWarnings({"rawtypes", "unchecked"})
    @Nullable CompletableFuture<? extends V>[] reloading = new CompletableFuture[1];
    Object keyReference = cache().referenceKey(key);

    var future = cache().refreshes().compute(keyReference, (k, existing) -> {
      if ((existing != null) && !Async.isReady(existing) && !cache().isPendingEviction(key)) {
        return existing;
      }

      try {
        startTime[0] = cache().statsTicker().read();
        oldValue[0] = cache().getIfPresentQuietly(key);
        var refreshFuture = (oldValue[0] == null)
            ? cacheLoader().asyncLoad(key, cache().executor())
            : cacheLoader().asyncReload(key, oldValue[0], cache().executor());
        reloading[0] = requireNonNull(refreshFuture, "Null future");
        return refreshFuture;
      } catch (RuntimeException e) {
        throw e;
      } catch (InterruptedException e) {
        Thread.currentThread().interrupt();
        throw new CompletionException(e);
      } catch (Exception e) {
        throw new CompletionException(e);
      }
    });

    if (reloading[0] != null) {
      reloading[0].whenComplete((newValue, error) -> {
        long loadTime = cache().statsTicker().read() - startTime[0];
        if (error != null) {
          if (!(error instanceof CancellationException) && !(error instanceof TimeoutException)) {
            logger.log(Level.WARNING, "Exception thrown during refresh", error);
          }
          cache().refreshes().remove(keyReference, reloading[0]);
          cache().statsCounter().recordLoadFailure(loadTime);
          return;
        }

        var discard = new boolean[1];
        var preserveTimestamps = new boolean[1];
        @Nullable V value = cache().compute(key, (K k, @Nullable V currentValue) -> {
          boolean removed = cache().refreshes().remove(keyReference, reloading[0]);
          if (removed && (currentValue == oldValue[0])) {
            return (currentValue == null) && (newValue == null) ? null : newValue;
          }
          discard[0] = (currentValue != newValue);
          preserveTimestamps[0] = true;
          return currentValue;
        }, cache().expiry(), /* recordLoad= */ false,
            /* recordLoadFailure= */ true, preserveTimestamps);

        if (discard[0] && (newValue != null)) {
          var cause = (value == null) ? RemovalCause.EXPLICIT : RemovalCause.REPLACED;
          cache().notifyRemoval(key, newValue, cause);
        }
        if (newValue == null) {
          cache().statsCounter().recordLoadFailure(loadTime);
        } else {
          cache().statsCounter().recordLoadSuccess(loadTime);
        }
