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
Fields Modifier and Type Field Description static DefaultCacheInvalidator
INSTANCE
private static org.slf4j.Logger
LOG
-
Constructor Summary
Constructors Constructor Description DefaultCacheInvalidator()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private boolean
flushAbsoluteUriFromSameHost(java.net.URI requestUri, java.net.URI uri, org.apache.hc.core5.function.Resolver<java.net.URI,java.lang.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<java.net.URI,java.lang.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<java.net.URI,java.lang.String> cacheKeyResolver, HttpCacheStorage storage)
FlushHttpCacheEntry
s invalidated by the given request.private void
flushLocationCacheEntry(org.apache.hc.core5.http.HttpResponse response, java.net.URI location, HttpCacheStorage storage, org.apache.hc.core5.function.Resolver<java.net.URI,java.lang.String> cacheKeyResolver)
private void
flushRelativeUriFromSameHost(java.net.URI requestUri, java.net.URI uri, org.apache.hc.core5.function.Resolver<java.net.URI,java.lang.String> cacheKeyResolver, HttpCacheStorage storage)
private HttpCacheEntry
getEntry(HttpCacheStorage storage, java.lang.String cacheKey)
private void
removeEntry(HttpCacheStorage storage, java.lang.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 Detail
-
INSTANCE
public static final DefaultCacheInvalidator INSTANCE
-
LOG
private static final org.slf4j.Logger LOG
-
-
Method Detail
-
getEntry
private HttpCacheEntry getEntry(HttpCacheStorage storage, java.lang.String cacheKey)
-
removeEntry
private void removeEntry(HttpCacheStorage storage, java.lang.String cacheKey)
-
flushCacheEntriesInvalidatedByRequest
public void flushCacheEntriesInvalidatedByRequest(org.apache.hc.core5.http.HttpHost host, org.apache.hc.core5.http.HttpRequest request, org.apache.hc.core5.function.Resolver<java.net.URI,java.lang.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(java.net.URI requestUri, java.net.URI uri, org.apache.hc.core5.function.Resolver<java.net.URI,java.lang.String> cacheKeyResolver, HttpCacheStorage storage)
-
flushAbsoluteUriFromSameHost
private boolean flushAbsoluteUriFromSameHost(java.net.URI requestUri, java.net.URI uri, org.apache.hc.core5.function.Resolver<java.net.URI,java.lang.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<java.net.URI,java.lang.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, java.net.URI location, HttpCacheStorage storage, org.apache.hc.core5.function.Resolver<java.net.URI,java.lang.String> cacheKeyResolver)
-
-