Interface HttpClientCache
- All Known Implementing Classes:
AbstractHttpClientCache,DefaultHttpClientCache
public interface HttpClientCache
Provides caching functionality to the
HttpClientAccessor.-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final HttpClientCacheConstant implementation of with disabled the cache logic. -
Method Summary
Modifier and TypeMethodDescriptionio.vavr.control.Try<org.apache.http.client.HttpClient>tryGetHttpClient(HttpClientFactory httpClientFactory) Gets the non-destination-specificHttpClientfrom this cache.io.vavr.control.Try<org.apache.http.client.HttpClient>tryGetHttpClient(HttpDestinationProperties destination, HttpClientFactory httpClientFactory) Gets theHttpClientfor the givenDestinationfrom this cache.
-
Field Details
-
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 theHttpClientfor the givenDestinationfrom this cache.If there is no
HttpClientfordestinationit is created by using theHttpClientFactory.- Parameters:
destination- TheDestinationto get theHttpClientfor.httpClientFactory- TheHttpClientFactoryused to create a newHttpClientif no cached one can be found.- Returns:
- The cached
HttpClientfor the givenDestination. - Throws:
HttpClientInstantiationException- If there is an issue while retrieving theHttpClient.
-
tryGetHttpClient
@Nonnull io.vavr.control.Try<org.apache.http.client.HttpClient> tryGetHttpClient(@Nonnull HttpClientFactory httpClientFactory) Gets the non-destination-specificHttpClientfrom this cache.If there is no generic
HttpClientit is created by using theHttpClientFactory.- Parameters:
httpClientFactory- TheHttpClientFactoryused to create a newHttpClientif no cached one can be found.- Returns:
- The cached
HttpClient.
-