public class TimeScopedHttpClientCache extends AbstractHttpClientCache
HttpClientCache
, caching the HttpClient
s for the amount of time given in the
constructor.Constructor and Description |
---|
TimeScopedHttpClientCache(long duration,
TimeUnit unit)
Caches the
HttpClient for the given duration. |
Modifier and Type | Method and Description |
---|---|
protected io.vavr.control.Try<com.github.benmanes.caffeine.cache.Cache<CacheKey,org.apache.http.client.HttpClient>> |
getCache()
Getter for the cache to be used.
|
protected io.vavr.control.Try<CacheKey> |
getCacheKey()
Method called in the
#getClient(HttpClientFactory) method to create a CacheKey for no specific
Destination . |
protected io.vavr.control.Try<CacheKey> |
getCacheKey(HttpDestinationProperties destination)
Method called in the
#getClient(Destination, HttpClientFactory) method to create a CacheKey for
the given Destination . |
tryGetHttpClient, tryGetHttpClient
@Nonnull protected io.vavr.control.Try<com.github.benmanes.caffeine.cache.Cache<CacheKey,org.apache.http.client.HttpClient>> getCache()
If the optional is empty a new HttpClient
will be created and not cached.
getCache
in class AbstractHttpClientCache
Try
of the cache to be used by the
AbstractHttpClientCache.tryGetHttpClient(HttpDestinationProperties, HttpClientFactory)
method.@Nonnull protected io.vavr.control.Try<CacheKey> getCacheKey(@Nonnull HttpDestinationProperties destination)
#getClient(Destination, HttpClientFactory)
method to create a CacheKey
for
the given Destination
.getCacheKey
in class AbstractHttpClientCache
destination
- The destination to create a CacheKey
for.Try
of the CacheKey
for destination.
@Nonnull protected io.vavr.control.Try<CacheKey> getCacheKey()
#getClient(HttpClientFactory)
method to create a CacheKey
for no specific
Destination
.getCacheKey
in class AbstractHttpClientCache
Try
of the CacheKey
for a generic HttpClient
.Copyright © 2020 SAP SE. All rights reserved.