Class BasicHttpCache
- java.lang.Object
-
- org.apache.hc.client5.http.impl.cache.BasicHttpCache
-
-
Field Summary
Fields Modifier and Type Field Description private HttpCacheEntryFactorycacheEntryFactoryprivate CacheKeyGeneratorcacheKeyGeneratorprivate static org.slf4j.LoggerLOGprivate ResourceFactoryresourceFactoryprivate HttpCacheStoragestorage
-
Constructor Summary
Constructors Constructor Description BasicHttpCache()BasicHttpCache(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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private voidevict(java.lang.String rootKey)private voidevict(java.lang.String rootKey, org.apache.hc.core5.http.HttpResponse response)private voidevictAll(HttpCacheEntry root, java.lang.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(java.lang.String cacheKey)java.util.List<CacheHit>getVariants(CacheHit hit)Retrieves variantHttpCacheEntrys for the given hit.CacheMatchmatch(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(java.lang.String cacheKey)(package private) CacheHitstore(java.lang.String rootKey, java.lang.String variantKey, HttpCacheEntry entry)CacheHitstore(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)StoresHttpRequest/HttpResponseexchange details in the cache.CacheHitstoreFromNegotiated(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)(package private) voidstoreInternal(java.lang.String cacheKey, HttpCacheEntry entry)CacheHitupdate(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)UpdatesHttpCacheEntryusing details from a 304HttpResponseand updates the root entry if the given cache entry represents a variant.(package private) voidupdateInternal(java.lang.String cacheKey, HttpCacheCASOperation casOperation)
-
-
-
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 HttpCacheStorage storage
-
-
Constructor Detail
-
BasicHttpCache
public BasicHttpCache(ResourceFactory resourceFactory, HttpCacheEntryFactory cacheEntryFactory, HttpCacheStorage storage, CacheKeyGenerator cacheKeyGenerator)
-
BasicHttpCache
public BasicHttpCache(ResourceFactory resourceFactory, HttpCacheStorage storage, CacheKeyGenerator cacheKeyGenerator)
-
BasicHttpCache
public BasicHttpCache(ResourceFactory resourceFactory, HttpCacheStorage storage)
-
BasicHttpCache
public BasicHttpCache(CacheConfig config)
-
BasicHttpCache
public BasicHttpCache()
-
-
Method Detail
-
storeInternal
void storeInternal(java.lang.String cacheKey, HttpCacheEntry entry)
-
updateInternal
void updateInternal(java.lang.String cacheKey, HttpCacheCASOperation casOperation)
-
getInternal
HttpCacheEntry getInternal(java.lang.String cacheKey)
-
removeInternal
private void removeInternal(java.lang.String cacheKey)
-
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
public java.util.List<CacheHit> getVariants(CacheHit hit)
Description copied from interface:HttpCacheRetrieves variantHttpCacheEntrys for the given hit.- Specified by:
getVariantsin interfaceHttpCache
-
store
CacheHit store(java.lang.String rootKey, java.lang.String variantKey, HttpCacheEntry entry)
-
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, java.time.Instant requestSent, java.time.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, java.time.Instant requestSent, java.time.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, java.time.Instant requestSent, java.time.Instant responseReceived)
Description copied from interface:HttpCache- Specified by:
storeFromNegotiatedin interfaceHttpCache
-
evictAll
private void evictAll(HttpCacheEntry root, java.lang.String rootKey)
-
evict
private void evict(java.lang.String rootKey)
-
evict
private void evict(java.lang.String rootKey, org.apache.hc.core5.http.HttpResponse response)
-
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
-
-