Class BasicHttpCache
java.lang.Object
org.apache.hc.client5.http.impl.cache.BasicHttpCache
- All Implemented Interfaces:
HttpCache
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final HttpCacheEntryFactoryprivate final CacheKeyGeneratorprivate static final org.slf4j.Loggerprivate final ResourceFactoryprivate final HttpCacheStorage -
Constructor Summary
ConstructorsConstructorDescriptionBasicHttpCache(ResourceFactory resourceFactory, HttpCacheEntryFactory cacheEntryFactory, HttpCacheStorage storage, CacheKeyGenerator cacheKeyGenerator) BasicHttpCache(ResourceFactory resourceFactory, HttpCacheStorage storage) BasicHttpCache(ResourceFactory resourceFactory, HttpCacheStorage storage, CacheKeyGenerator cacheKeyGenerator) BasicHttpCache(CacheConfig config) -
Method Summary
Modifier and TypeMethodDescriptionprivate voidprivate voidprivate voidevictAll(HttpCacheEntry root, String rootKey) voidevictInvalidatedEntries(org.apache.hc.core5.http.HttpHost host, org.apache.hc.core5.http.HttpRequest request, org.apache.hc.core5.http.HttpResponse response) EvictsHttpCacheEntrys invalidated by the given message exchange.(package private) HttpCacheEntrygetInternal(String cacheKey) getVariants(CacheHit hit) Retrieves variantHttpCacheEntrys for the given hit.match(org.apache.hc.core5.http.HttpHost host, org.apache.hc.core5.http.HttpRequest request) Returns a result with either a fully matchingHttpCacheEntrya partial match with a list of known variants or null if no match could be found.private voidremoveInternal(String cacheKey) (package private) CacheHitstore(String rootKey, String variantKey, HttpCacheEntry entry) store(org.apache.hc.core5.http.HttpHost host, org.apache.hc.core5.http.HttpRequest request, org.apache.hc.core5.http.HttpResponse originResponse, org.apache.hc.core5.util.ByteArrayBuffer content, Instant requestSent, Instant responseReceived) StoresHttpRequest/HttpResponseexchange details in the cache.storeFromNegotiated(CacheHit negotiated, org.apache.hc.core5.http.HttpHost host, org.apache.hc.core5.http.HttpRequest request, org.apache.hc.core5.http.HttpResponse originResponse, Instant requestSent, Instant responseReceived) (package private) voidstoreInternal(String cacheKey, HttpCacheEntry entry) update(CacheHit stale, org.apache.hc.core5.http.HttpHost host, org.apache.hc.core5.http.HttpRequest request, org.apache.hc.core5.http.HttpResponse originResponse, Instant requestSent, Instant responseReceived) UpdatesHttpCacheEntryusing details from a 304HttpResponseand updates the root entry if the given cache entry represents a variant.(package private) voidupdateInternal(String cacheKey, HttpCacheCASOperation casOperation)
-
Field Details
-
LOG
private static final org.slf4j.Logger LOG -
resourceFactory
-
cacheEntryFactory
-
cacheKeyGenerator
-
storage
-
-
Constructor Details
-
BasicHttpCache
public BasicHttpCache(ResourceFactory resourceFactory, HttpCacheEntryFactory cacheEntryFactory, HttpCacheStorage storage, CacheKeyGenerator cacheKeyGenerator) -
BasicHttpCache
public BasicHttpCache(ResourceFactory resourceFactory, HttpCacheStorage storage, CacheKeyGenerator cacheKeyGenerator) -
BasicHttpCache
-
BasicHttpCache
-
BasicHttpCache
public BasicHttpCache()
-
-
Method Details
-
storeInternal
-
updateInternal
-
getInternal
-
removeInternal
-
match
public CacheMatch match(org.apache.hc.core5.http.HttpHost host, org.apache.hc.core5.http.HttpRequest request) Description copied from interface:HttpCacheReturns a result with either a fully matchingHttpCacheEntrya partial match with a list of known variants or null if no match could be found. -
getVariants
Description copied from interface:HttpCacheRetrieves variantHttpCacheEntrys for the given hit.- Specified by:
getVariantsin interfaceHttpCache
-
store
-
store
public CacheHit store(org.apache.hc.core5.http.HttpHost host, org.apache.hc.core5.http.HttpRequest request, org.apache.hc.core5.http.HttpResponse originResponse, org.apache.hc.core5.util.ByteArrayBuffer content, Instant requestSent, Instant responseReceived) Description copied from interface:HttpCacheStoresHttpRequest/HttpResponseexchange details in the cache. -
update
public CacheHit update(CacheHit stale, org.apache.hc.core5.http.HttpHost host, org.apache.hc.core5.http.HttpRequest request, org.apache.hc.core5.http.HttpResponse originResponse, Instant requestSent, Instant responseReceived) Description copied from interface:HttpCacheUpdatesHttpCacheEntryusing details from a 304HttpResponseand updates the root entry if the given cache entry represents a variant. -
storeFromNegotiated
public CacheHit storeFromNegotiated(CacheHit negotiated, org.apache.hc.core5.http.HttpHost host, org.apache.hc.core5.http.HttpRequest request, org.apache.hc.core5.http.HttpResponse originResponse, Instant requestSent, Instant responseReceived) Description copied from interface:HttpCache- Specified by:
storeFromNegotiatedin interfaceHttpCache
-
evictAll
-
evict
-
evict
-
evictInvalidatedEntries
public void evictInvalidatedEntries(org.apache.hc.core5.http.HttpHost host, org.apache.hc.core5.http.HttpRequest request, org.apache.hc.core5.http.HttpResponse response) Description copied from interface:HttpCacheEvictsHttpCacheEntrys invalidated by the given message exchange.- Specified by:
evictInvalidatedEntriesin interfaceHttpCache
-