Interface HttpClientCache
- All Known Implementing Classes:
AbstractHttpClientCache
,DefaultHttpClientCache
public interface HttpClientCache
Provides caching functionality to the
HttpClientAccessor
.-
Field Summary
Modifier and TypeFieldDescriptionstatic final HttpClientCache
Constant 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-specificHttpClient
from this cache.io.vavr.control.Try<org.apache.http.client.HttpClient>
tryGetHttpClient
(HttpDestinationProperties destination, HttpClientFactory httpClientFactory) Gets theHttpClient
for the givenDestination
from 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 theHttpClient
for the givenDestination
from this cache.If there is no
HttpClient
fordestination
it is created by using theHttpClientFactory
.- Parameters:
destination
- TheDestination
to get theHttpClient
for.httpClientFactory
- TheHttpClientFactory
used to create a newHttpClient
if no cached one can be found.- Returns:
- The cached
HttpClient
for 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-specificHttpClient
from this cache.If there is no generic
HttpClient
it is created by using theHttpClientFactory
.- Parameters:
httpClientFactory
- TheHttpClientFactory
used to create a newHttpClient
if no cached one can be found.- Returns:
- The cached
HttpClient
.
-