Class BasicHttpAsyncCache
- java.lang.Object
-
- org.apache.hc.client5.http.impl.cache.BasicHttpAsyncCache
-
- All Implemented Interfaces:
HttpAsyncCache
class BasicHttpAsyncCache extends java.lang.Object implements HttpAsyncCache
-
-
Field Summary
Fields Modifier and Type Field Description private HttpCacheEntryFactorycacheEntryFactoryprivate CacheKeyGeneratorcacheKeyGeneratorprivate static org.slf4j.LoggerLOGprivate ResourceFactoryresourceFactoryprivate HttpAsyncCacheStoragestorage
-
Constructor Summary
Constructors Constructor Description BasicHttpAsyncCache(ResourceFactory resourceFactory, HttpAsyncCacheStorage storage)BasicHttpAsyncCache(ResourceFactory resourceFactory, HttpAsyncCacheStorage storage, CacheKeyGenerator cacheKeyGenerator)BasicHttpAsyncCache(ResourceFactory resourceFactory, HttpCacheEntryFactory cacheEntryFactory, HttpAsyncCacheStorage storage, CacheKeyGenerator cacheKeyGenerator)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private org.apache.hc.core5.concurrent.Cancellableevict(java.lang.String rootKey)private org.apache.hc.core5.concurrent.Cancellableevict(java.lang.String rootKey, org.apache.hc.core5.http.HttpResponse response)private voidevictAll(HttpCacheEntry root, java.lang.String rootKey)org.apache.hc.core5.concurrent.CancellableevictInvalidatedEntries(org.apache.hc.core5.http.HttpHost host, org.apache.hc.core5.http.HttpRequest request, org.apache.hc.core5.http.HttpResponse response, org.apache.hc.core5.concurrent.FutureCallback<java.lang.Boolean> callback)EvictsHttpCacheEntrys invalidated by the given message exchange.org.apache.hc.core5.concurrent.CancellablegetVariants(CacheHit hit, org.apache.hc.core5.concurrent.FutureCallback<java.util.Collection<CacheHit>> callback)Retrieves variantHttpCacheEntrys for the given hit.org.apache.hc.core5.concurrent.Cancellablematch(org.apache.hc.core5.http.HttpHost host, org.apache.hc.core5.http.HttpRequest request, org.apache.hc.core5.concurrent.FutureCallback<CacheMatch> callback)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(java.lang.String cacheKey)(package private) org.apache.hc.core5.concurrent.Cancellablestore(java.lang.String rootKey, java.lang.String variantKey, HttpCacheEntry entry, org.apache.hc.core5.concurrent.FutureCallback<CacheHit> callback)org.apache.hc.core5.concurrent.Cancellablestore(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, java.time.Instant requestSent, java.time.Instant responseReceived, org.apache.hc.core5.concurrent.FutureCallback<CacheHit> callback)StoresHttpRequest/HttpResponseexchange details in the cache.org.apache.hc.core5.concurrent.CancellablestoreFromNegotiated(CacheHit negotiated, org.apache.hc.core5.http.HttpHost host, org.apache.hc.core5.http.HttpRequest request, org.apache.hc.core5.http.HttpResponse originResponse, java.time.Instant requestSent, java.time.Instant responseReceived, org.apache.hc.core5.concurrent.FutureCallback<CacheHit> callback)(package private) org.apache.hc.core5.concurrent.CancellablestoreInternal(java.lang.String cacheKey, HttpCacheEntry entry, org.apache.hc.core5.concurrent.FutureCallback<java.lang.Boolean> callback)org.apache.hc.core5.concurrent.Cancellableupdate(CacheHit stale, org.apache.hc.core5.http.HttpHost host, org.apache.hc.core5.http.HttpRequest request, org.apache.hc.core5.http.HttpResponse originResponse, java.time.Instant requestSent, java.time.Instant responseReceived, org.apache.hc.core5.concurrent.FutureCallback<CacheHit> callback)UpdatesHttpCacheEntryusing details from a 304HttpResponseand updates the root entry if the given cache entry represents a variant.(package private) org.apache.hc.core5.concurrent.CancellableupdateInternal(java.lang.String cacheKey, HttpCacheCASOperation casOperation, org.apache.hc.core5.concurrent.FutureCallback<java.lang.Boolean> callback)
-
-
-
Field Detail
-
LOG
private static final org.slf4j.Logger LOG
-
resourceFactory
private final ResourceFactory resourceFactory
-
cacheEntryFactory
private final HttpCacheEntryFactory cacheEntryFactory
-
cacheKeyGenerator
private final CacheKeyGenerator cacheKeyGenerator
-
storage
private final HttpAsyncCacheStorage storage
-
-
Constructor Detail
-
BasicHttpAsyncCache
public BasicHttpAsyncCache(ResourceFactory resourceFactory, HttpCacheEntryFactory cacheEntryFactory, HttpAsyncCacheStorage storage, CacheKeyGenerator cacheKeyGenerator)
-
BasicHttpAsyncCache
public BasicHttpAsyncCache(ResourceFactory resourceFactory, HttpAsyncCacheStorage storage, CacheKeyGenerator cacheKeyGenerator)
-
BasicHttpAsyncCache
public BasicHttpAsyncCache(ResourceFactory resourceFactory, HttpAsyncCacheStorage storage)
-
-
Method Detail
-
match
public org.apache.hc.core5.concurrent.Cancellable match(org.apache.hc.core5.http.HttpHost host, org.apache.hc.core5.http.HttpRequest request, org.apache.hc.core5.concurrent.FutureCallback<CacheMatch> callback)Description copied from interface:HttpAsyncCacheReturns a result with either a fully matchingHttpCacheEntrya partial match with a list of known variants or null if no match could be found.- Specified by:
matchin interfaceHttpAsyncCache
-
getVariants
public org.apache.hc.core5.concurrent.Cancellable getVariants(CacheHit hit, org.apache.hc.core5.concurrent.FutureCallback<java.util.Collection<CacheHit>> callback)
Description copied from interface:HttpAsyncCacheRetrieves variantHttpCacheEntrys for the given hit.- Specified by:
getVariantsin interfaceHttpAsyncCache
-
storeInternal
org.apache.hc.core5.concurrent.Cancellable storeInternal(java.lang.String cacheKey, HttpCacheEntry entry, org.apache.hc.core5.concurrent.FutureCallback<java.lang.Boolean> callback)
-
updateInternal
org.apache.hc.core5.concurrent.Cancellable updateInternal(java.lang.String cacheKey, HttpCacheCASOperation casOperation, org.apache.hc.core5.concurrent.FutureCallback<java.lang.Boolean> callback)
-
removeInternal
private void removeInternal(java.lang.String cacheKey)
-
store
org.apache.hc.core5.concurrent.Cancellable store(java.lang.String rootKey, java.lang.String variantKey, HttpCacheEntry entry, org.apache.hc.core5.concurrent.FutureCallback<CacheHit> callback)
-
store
public org.apache.hc.core5.concurrent.Cancellable 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, java.time.Instant requestSent, java.time.Instant responseReceived, org.apache.hc.core5.concurrent.FutureCallback<CacheHit> callback)Description copied from interface:HttpAsyncCacheStoresHttpRequest/HttpResponseexchange details in the cache.- Specified by:
storein interfaceHttpAsyncCache
-
update
public org.apache.hc.core5.concurrent.Cancellable update(CacheHit stale, org.apache.hc.core5.http.HttpHost host, org.apache.hc.core5.http.HttpRequest request, org.apache.hc.core5.http.HttpResponse originResponse, java.time.Instant requestSent, java.time.Instant responseReceived, org.apache.hc.core5.concurrent.FutureCallback<CacheHit> callback)
Description copied from interface:HttpAsyncCacheUpdatesHttpCacheEntryusing details from a 304HttpResponseand updates the root entry if the given cache entry represents a variant.- Specified by:
updatein interfaceHttpAsyncCache
-
storeFromNegotiated
public org.apache.hc.core5.concurrent.Cancellable storeFromNegotiated(CacheHit negotiated, org.apache.hc.core5.http.HttpHost host, org.apache.hc.core5.http.HttpRequest request, org.apache.hc.core5.http.HttpResponse originResponse, java.time.Instant requestSent, java.time.Instant responseReceived, org.apache.hc.core5.concurrent.FutureCallback<CacheHit> callback)
Description copied from interface:HttpAsyncCache- Specified by:
storeFromNegotiatedin interfaceHttpAsyncCache
-
evictAll
private void evictAll(HttpCacheEntry root, java.lang.String rootKey)
-
evict
private org.apache.hc.core5.concurrent.Cancellable evict(java.lang.String rootKey)
-
evict
private org.apache.hc.core5.concurrent.Cancellable evict(java.lang.String rootKey, org.apache.hc.core5.http.HttpResponse response)
-
evictInvalidatedEntries
public org.apache.hc.core5.concurrent.Cancellable evictInvalidatedEntries(org.apache.hc.core5.http.HttpHost host, org.apache.hc.core5.http.HttpRequest request, org.apache.hc.core5.http.HttpResponse response, org.apache.hc.core5.concurrent.FutureCallback<java.lang.Boolean> callback)Description copied from interface:HttpAsyncCacheEvictsHttpCacheEntrys invalidated by the given message exchange.- Specified by:
evictInvalidatedEntriesin interfaceHttpAsyncCache
-
-