Interface CachingWebClient


public interface CachingWebClient
An asynchronous cache aware HTTP / HTTP/2 client called CachingWebClient.

This client wraps a WebClient and makes it cache aware by adding features to it:

  • Cache-Control header parsing
  • Freshness checking

The client honors the following cache headers:

  • Cache-Control with the following properties understood:
    • public
    • private
    • no-cache
    • no-store
    • max-age
    • s-maxage
    • stale-if-error
    • stale-while-revalidate
    • must-revalidate
  • Expires
  • ETag
  • Vary

Caching only applies to requests using the default buffer response codec. A request configured with another body codec (for example via HttpRequest.as(io.vertx.ext.web.codec.BodyCodec)) bypasses the cache entirely: its response is neither stored nor served from the cache, because the raw response body is not available for caching.

Author:
Craig Day
  • Method Details

    • create

      static WebClient create(WebClient webClient)
      Create a cache aware web client using the provided WebClient.
      Parameters:
      webClient - the web client instance
      Returns:
      the created web client
    • create

      static WebClient create(WebClient webClient, CacheStore cacheStore)
      Create a cache aware web client using the provided WebClient.
      Parameters:
      webClient - the web client instance
      cacheStore - the cache adapter
      Returns:
      the created web client
    • create

      static WebClient create(WebClient webClient, CachingWebClientOptions options)
      Create a cache aware web client using the provided WebClient.
      Parameters:
      webClient - the web client instance
      options - the caching web client options
      Returns:
      the created web client
    • create

      static WebClient create(WebClient webClient, CacheStore cacheStore, CachingWebClientOptions options)
      Create a cache aware web client using the provided WebClient.
      Parameters:
      webClient - the web client instance
      cacheStore - the cache adapter
      options - the caching web client options
      Returns:
      the created web client
    • create

      static WebClient create(WebClient webClient, CacheStore cacheStore, CachingWebClientConfig options)
      Create a cache aware web client using the provided WebClient.
      Parameters:
      webClient - the web client instance
      cacheStore - the cache adapter
      options - the caching web client options
      Returns:
      the created web client