Class CacheUpdateHandler
- java.lang.Object
-
- org.apache.hc.client5.http.impl.cache.CacheUpdateHandler
-
class CacheUpdateHandler extends java.lang.Object
Creates newHttpCacheEntry
s and updates existing ones with new or updated information based on the response from the origin server.
-
-
Field Summary
Fields Modifier and Type Field Description private ResourceFactory
resourceFactory
-
Constructor Summary
Constructors Constructor Description CacheUpdateHandler()
CacheUpdateHandler(ResourceFactory resourceFactory)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description HttpCacheEntry
createCacheEntry(org.apache.hc.core5.http.HttpRequest request, org.apache.hc.core5.http.HttpResponse originResponse, org.apache.hc.core5.util.ByteArrayBuffer content, java.time.Instant requestSent, java.time.Instant responseReceived)
Creates a cache entry for the given request, origin response message and response content.private org.apache.hc.core5.http.Header[]
mergeHeaders(HttpCacheEntry entry, org.apache.hc.core5.http.HttpResponse response)
HttpCacheEntry
updateCacheEntry(java.lang.String requestId, HttpCacheEntry entry, java.time.Instant requestDate, java.time.Instant responseDate, org.apache.hc.core5.http.HttpResponse response)
Update the entry with the new information from the response.HttpCacheEntry
updateParentCacheEntry(java.lang.String requestId, HttpCacheEntry existing, HttpCacheEntry entry, java.lang.String variantKey, java.lang.String variantCacheKey)
-
-
-
Field Detail
-
resourceFactory
private final ResourceFactory resourceFactory
-
-
Constructor Detail
-
CacheUpdateHandler
CacheUpdateHandler()
-
CacheUpdateHandler
CacheUpdateHandler(ResourceFactory resourceFactory)
-
-
Method Detail
-
createCacheEntry
public HttpCacheEntry createCacheEntry(org.apache.hc.core5.http.HttpRequest request, org.apache.hc.core5.http.HttpResponse originResponse, org.apache.hc.core5.util.ByteArrayBuffer content, java.time.Instant requestSent, java.time.Instant responseReceived) throws ResourceIOException
Creates a cache entry for the given request, origin response message and response content.- Throws:
ResourceIOException
-
updateCacheEntry
public HttpCacheEntry updateCacheEntry(java.lang.String requestId, HttpCacheEntry entry, java.time.Instant requestDate, java.time.Instant responseDate, org.apache.hc.core5.http.HttpResponse response) throws ResourceIOException
Update the entry with the new information from the response. Should only be used for 304 responses.- Throws:
ResourceIOException
-
updateParentCacheEntry
public HttpCacheEntry updateParentCacheEntry(java.lang.String requestId, HttpCacheEntry existing, HttpCacheEntry entry, java.lang.String variantKey, java.lang.String variantCacheKey) throws ResourceIOException
- Throws:
ResourceIOException
-
mergeHeaders
private org.apache.hc.core5.http.Header[] mergeHeaders(HttpCacheEntry entry, org.apache.hc.core5.http.HttpResponse response)
-
-