title: How is spring flux cache item managed
body: <p>Consider code example:</p>
  
  <pre><code>import org.springframework.beans.factory.annotation.Autowired;
  import org.springframework.stereotype.Component;
  import org.springframework.web.reactive.function.client.WebClient;
  import reactor.core.publisher.Mono;
  
  import java.time.Duration;
  
  import static com.google.common.collect.ImmutableMap.of;
  
  @Component
  public class Scratch {
  
      @Autowired
      private WebClient webClient;
  
      public Mono&lt;MyClass&gt; getMyClass(Long id) {
          return webClient.get()
                  .uri("{id}", of("id", id))
                  .retrieve()
                  .bodyToMono(MyClass.class)
                  .cache(Duration.ofHours(1));
      }
  }
  </code></pre>
  
  <p>The specification <a href="https://projectreactor.io/docs/core/release/api/reactor/core/publisher/Flux.html#cache-java.time.Duration-" rel="nofollow noreferrer">tells</a>:</p>
  
  <blockquote>
    <p>Will retain an unbounded history but apply a per-item expiry timeout</p>
  </blockquote>
  
  <p>What is item and what is cached?</p>
  
  <ol>
  <li>Entire http call is cached. E.g. if I call method chain <code>.get().uri()</code> with <code>id = 1</code> any subsequent calls will be cached? or</li>
  <li>Only <code>Mono&lt;MyClass&gt;</code> is cached. E.g. any subsequent call to <code>Mono.map</code> will use cached value?</li>
  </ol>
  
  <p>In both cases what is considered as item?</p>