Class CachingExecBase
java.lang.Object
org.apache.hc.client5.http.impl.cache.CachingExecBase
- Direct Known Subclasses:
AsyncCachingExec, CachingExec
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) final CacheableRequestPolicy(package private) final CacheConfig(package private) final AtomicLong(package private) final AtomicLong(package private) final AtomicLong(package private) final ResponseCachingPolicy(package private) final CachedHttpResponseGenerator(package private) final CachedResponseSuitabilityChecker(package private) final CacheValidityPolicy -
Constructor Summary
ConstructorsConstructorDescriptionCachingExecBase(CacheConfig config) CachingExecBase(CacheValidityPolicy validityPolicy, ResponseCachingPolicy responseCachingPolicy, CachedHttpResponseGenerator responseGenerator, CacheableRequestPolicy cacheableRequestPolicy, CachedResponseSuitabilityChecker suitabilityChecker, CacheConfig config) -
Method Summary
Modifier and TypeMethodDescription(package private) booleanclientRequestsOurOptions(org.apache.hc.core5.http.HttpRequest request) (package private) SimpleHttpResponsegenerateCachedResponse(org.apache.hc.core5.http.HttpRequest request, HttpCacheEntry entry, Instant now) (package private) SimpleHttpResponselongReports the number of times that the cache successfully responded to anHttpRequestwithout contacting the origin server.longReports the number of times that the cache contacted the origin server because it had no appropriate response cached.longReports the number of times that the cache was able to satisfy a response by revalidating an existing but stale cache entry.(package private) Instant(package private) booleanisResponseTooBig(org.apache.hc.core5.http.EntityDetails entityDetails) (package private) booleanshouldSendNotModifiedResponse(org.apache.hc.core5.http.HttpRequest request, HttpCacheEntry responseEntry, Instant now) (package private) booleanstaleIfErrorAppliesTo(int statusCode) (package private) voidstoreRequestIfModifiedSinceFor304Response(org.apache.hc.core5.http.HttpRequest request, org.apache.hc.core5.http.HttpResponse backendResponse) For 304 Not modified responses, adds a "Last-Modified" header with the value of the "If-Modified-Since" header passed in the request.
-
Field Details
-
cacheHits
-
cacheMisses
-
cacheUpdates
-
responseCachingPolicy
-
validityPolicy
-
responseGenerator
-
cacheableRequestPolicy
-
suitabilityChecker
-
cacheConfig
-
-
Constructor Details
-
CachingExecBase
CachingExecBase(CacheValidityPolicy validityPolicy, ResponseCachingPolicy responseCachingPolicy, CachedHttpResponseGenerator responseGenerator, CacheableRequestPolicy cacheableRequestPolicy, CachedResponseSuitabilityChecker suitabilityChecker, CacheConfig config) -
CachingExecBase
CachingExecBase(CacheConfig config)
-
-
Method Details
-
getCacheHits
public long getCacheHits()Reports the number of times that the cache successfully responded to anHttpRequestwithout contacting the origin server.- Returns:
- the number of cache hits
-
getCacheMisses
public long getCacheMisses()Reports the number of times that the cache contacted the origin server because it had no appropriate response cached.- Returns:
- the number of cache misses
-
getCacheUpdates
public long getCacheUpdates()Reports the number of times that the cache was able to satisfy a response by revalidating an existing but stale cache entry.- Returns:
- the number of cache revalidations
-
generateCachedResponse
SimpleHttpResponse generateCachedResponse(org.apache.hc.core5.http.HttpRequest request, HttpCacheEntry entry, Instant now) throws ResourceIOException - Throws:
ResourceIOException
-
generateGatewayTimeout
SimpleHttpResponse generateGatewayTimeout() -
getCurrentDate
Instant getCurrentDate() -
clientRequestsOurOptions
boolean clientRequestsOurOptions(org.apache.hc.core5.http.HttpRequest request) -
shouldSendNotModifiedResponse
boolean shouldSendNotModifiedResponse(org.apache.hc.core5.http.HttpRequest request, HttpCacheEntry responseEntry, Instant now) -
staleIfErrorAppliesTo
boolean staleIfErrorAppliesTo(int statusCode) -
storeRequestIfModifiedSinceFor304Response
void storeRequestIfModifiedSinceFor304Response(org.apache.hc.core5.http.HttpRequest request, org.apache.hc.core5.http.HttpResponse backendResponse) For 304 Not modified responses, adds a "Last-Modified" header with the value of the "If-Modified-Since" header passed in the request. This header is required to be able to reuse match the cache entry for subsequent requests but as defined in http specifications it is not included in 304 responses by backend servers. This header will not be included in the resulting response. -
isResponseTooBig
boolean isResponseTooBig(org.apache.hc.core5.http.EntityDetails entityDetails)
-