Interface HttpClientCache

All Known Implementing Classes:
AbstractHttpClientCache, DefaultHttpClientCache

public interface HttpClientCache
Provides caching functionality to the HttpClientAccessor.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final HttpClientCache
    Constant implementation of with disabled the cache logic.
  • Method Summary

    Modifier and Type
    Method
    Description
    io.vavr.control.Try<org.apache.http.client.HttpClient>
    Gets the non-destination-specific HttpClient from this cache.
    io.vavr.control.Try<org.apache.http.client.HttpClient>
    Gets the HttpClient for the given Destination from this cache.
  • Field Details

    • DISABLED

      @Nonnull static final HttpClientCache DISABLED
      Constant implementation of with disabled the cache logic. Useful for testing and troubleshooting. Don't use in production.
  • Method Details

    • tryGetHttpClient

      @Nonnull io.vavr.control.Try<org.apache.http.client.HttpClient> tryGetHttpClient(@Nonnull HttpDestinationProperties destination, @Nonnull HttpClientFactory httpClientFactory)
      Gets the HttpClient for the given Destination from this cache.

      If there is no HttpClient for destination it is created by using the HttpClientFactory.

      Parameters:
      destination - The Destination to get the HttpClient for.
      httpClientFactory - The HttpClientFactory used to create a new HttpClient if no cached one can be found.
      Returns:
      The cached HttpClient for the given Destination.
      Throws:
      HttpClientInstantiationException - If there is an issue while retrieving the HttpClient.
    • tryGetHttpClient

      @Nonnull io.vavr.control.Try<org.apache.http.client.HttpClient> tryGetHttpClient(@Nonnull HttpClientFactory httpClientFactory)
      Gets the non-destination-specific HttpClient from this cache.

      If there is no generic HttpClient it is created by using the HttpClientFactory.

      Parameters:
      httpClientFactory - The HttpClientFactory used to create a new HttpClient if no cached one can be found.
      Returns:
      The cached HttpClient.