Class DefaultCacheInvalidator
java.lang.Object
org.apache.hc.client5.http.impl.cache.CacheInvalidatorBase
org.apache.hc.client5.http.impl.cache.DefaultCacheInvalidator
- All Implemented Interfaces:
HttpCacheInvalidator
@Contract(threading=STATELESS)
@Internal
public class DefaultCacheInvalidator
extends CacheInvalidatorBase
implements HttpCacheInvalidator
Given a particular HTTP request / response pair, flush any cache entries
that this exchange would invalidate.
- Since:
- 4.1
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final DefaultCacheInvalidator
private static final org.slf4j.Logger
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate boolean
flushAbsoluteUriFromSameHost
(URI requestUri, URI uri, org.apache.hc.core5.function.Resolver<URI, String> cacheKeyResolver, HttpCacheStorage storage) void
flushCacheEntriesInvalidatedByExchange
(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.function.Resolver<URI, String> cacheKeyResolver, HttpCacheStorage storage) FlushHttpCacheEntry
s invalidated by the given message exchange.void
flushCacheEntriesInvalidatedByRequest
(org.apache.hc.core5.http.HttpHost host, org.apache.hc.core5.http.HttpRequest request, org.apache.hc.core5.function.Resolver<URI, String> cacheKeyResolver, HttpCacheStorage storage) FlushHttpCacheEntry
s invalidated by the given request.private void
flushLocationCacheEntry
(org.apache.hc.core5.http.HttpResponse response, URI location, HttpCacheStorage storage, org.apache.hc.core5.function.Resolver<URI, String> cacheKeyResolver) private void
flushRelativeUriFromSameHost
(URI requestUri, URI uri, org.apache.hc.core5.function.Resolver<URI, String> cacheKeyResolver, HttpCacheStorage storage) private HttpCacheEntry
getEntry
(HttpCacheStorage storage, String cacheKey) private void
removeEntry
(HttpCacheStorage storage, String cacheKey) Methods inherited from class org.apache.hc.client5.http.impl.cache.CacheInvalidatorBase
getContentLocationURI, getLocationURI, isAHeadCacheEntry, isSameHost, notGetOrHeadRequest, requestIsGet, requestShouldNotBeCached, responseAndEntryEtagsDiffer, responseDateOlderThanEntryDate, shouldInvalidateHeadCacheEntry
-
Field Details
-
INSTANCE
-
LOG
private static final org.slf4j.Logger LOG
-
-
Constructor Details
-
DefaultCacheInvalidator
public DefaultCacheInvalidator()
-
-
Method Details
-
getEntry
-
removeEntry
-
flushCacheEntriesInvalidatedByRequest
public void flushCacheEntriesInvalidatedByRequest(org.apache.hc.core5.http.HttpHost host, org.apache.hc.core5.http.HttpRequest request, org.apache.hc.core5.function.Resolver<URI, String> cacheKeyResolver, HttpCacheStorage storage) Description copied from interface:HttpCacheInvalidator
FlushHttpCacheEntry
s invalidated by the given request.- Specified by:
flushCacheEntriesInvalidatedByRequest
in interfaceHttpCacheInvalidator
- Parameters:
host
- backend hostrequest
- request messagecacheKeyResolver
- cache key resolver used by cache storagestorage
- internal cache storage
-
flushRelativeUriFromSameHost
private void flushRelativeUriFromSameHost(URI requestUri, URI uri, org.apache.hc.core5.function.Resolver<URI, String> cacheKeyResolver, HttpCacheStorage storage) -
flushAbsoluteUriFromSameHost
private boolean flushAbsoluteUriFromSameHost(URI requestUri, URI uri, org.apache.hc.core5.function.Resolver<URI, String> cacheKeyResolver, HttpCacheStorage storage) -
flushCacheEntriesInvalidatedByExchange
public void flushCacheEntriesInvalidatedByExchange(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.function.Resolver<URI, String> cacheKeyResolver, HttpCacheStorage storage) Description copied from interface:HttpCacheInvalidator
FlushHttpCacheEntry
s invalidated by the given message exchange.- Specified by:
flushCacheEntriesInvalidatedByExchange
in interfaceHttpCacheInvalidator
- Parameters:
host
- backend hostrequest
- request messageresponse
- response messagecacheKeyResolver
- cache key resolver used by cache storagestorage
- internal cache storage
-
flushLocationCacheEntry
private void flushLocationCacheEntry(org.apache.hc.core5.http.HttpResponse response, URI location, HttpCacheStorage storage, org.apache.hc.core5.function.Resolver<URI, String> cacheKeyResolver)
-