Renamed class (no functional changes)
This commit is contained in:
parent
fc41f47ad3
commit
f70c974241
|
@ -80,7 +80,7 @@ class BasicHttpCache implements HttpCache {
|
|||
final ResourceFactory resourceFactory,
|
||||
final HttpCacheStorage storage,
|
||||
final CacheKeyGenerator uriExtractor) {
|
||||
this(resourceFactory, storage, uriExtractor, new CacheInvalidator(uriExtractor, storage));
|
||||
this(resourceFactory, storage, uriExtractor, new DefaultCacheInvalidator(uriExtractor, storage));
|
||||
}
|
||||
|
||||
public BasicHttpCache(final ResourceFactory resourceFactory, final HttpCacheStorage storage) {
|
||||
|
|
|
@ -135,7 +135,7 @@ public class CachingHttpAsyncClientBuilder extends HttpAsyncClientBuilder {
|
|||
resourceFactoryCopy,
|
||||
storageCopy,
|
||||
uriExtractor,
|
||||
this.httpCacheInvalidator != null ? this.httpCacheInvalidator : new CacheInvalidator(uriExtractor, storageCopy));
|
||||
this.httpCacheInvalidator != null ? this.httpCacheInvalidator : new DefaultCacheInvalidator(uriExtractor, storageCopy));
|
||||
|
||||
final AsyncCachingExec cachingExec = new AsyncCachingExec(httpCache, config);
|
||||
execChainDefinition.addBefore(ChainElements.PROTOCOL.name(), cachingExec, ChainElements.CACHING.name());
|
||||
|
|
|
@ -135,7 +135,7 @@ public class CachingHttpClientBuilder extends HttpClientBuilder {
|
|||
resourceFactoryCopy,
|
||||
storageCopy,
|
||||
uriExtractor,
|
||||
this.httpCacheInvalidator != null ? this.httpCacheInvalidator : new CacheInvalidator(uriExtractor, storageCopy));
|
||||
this.httpCacheInvalidator != null ? this.httpCacheInvalidator : new DefaultCacheInvalidator(uriExtractor, storageCopy));
|
||||
|
||||
final CachingExec cachingExec = new CachingExec(httpCache, config);
|
||||
execChainDefinition.addBefore(ChainElements.PROTOCOL.name(), cachingExec, ChainElements.CACHING.name());
|
||||
|
|
|
@ -54,7 +54,7 @@ import org.apache.logging.log4j.Logger;
|
|||
* @since 4.1
|
||||
*/
|
||||
@Contract(threading = ThreadingBehavior.IMMUTABLE)
|
||||
class CacheInvalidator implements HttpCacheInvalidator {
|
||||
class DefaultCacheInvalidator implements HttpCacheInvalidator {
|
||||
|
||||
private final HttpCacheStorage storage;
|
||||
private final CacheKeyGenerator cacheKeyGenerator;
|
||||
|
@ -62,13 +62,13 @@ class CacheInvalidator implements HttpCacheInvalidator {
|
|||
private final Logger log = LogManager.getLogger(getClass());
|
||||
|
||||
/**
|
||||
* Create a new {@link CacheInvalidator} for a given {@link HttpCache} and
|
||||
* Create a new {@link DefaultCacheInvalidator} for a given {@link HttpCache} and
|
||||
* {@link CacheKeyGenerator}.
|
||||
*
|
||||
* @param cacheKeyGenerator Provides identifiers for the keys to store cache entries
|
||||
* @param storage the cache to store items away in
|
||||
*/
|
||||
public CacheInvalidator(
|
||||
public DefaultCacheInvalidator(
|
||||
final CacheKeyGenerator cacheKeyGenerator,
|
||||
final HttpCacheStorage storage) {
|
||||
this.cacheKeyGenerator = cacheKeyGenerator;
|
|
@ -46,16 +46,15 @@ import org.apache.hc.core5.http.ClassicHttpResponse;
|
|||
import org.apache.hc.core5.http.Header;
|
||||
import org.apache.hc.core5.http.HttpHost;
|
||||
import org.apache.hc.core5.http.HttpStatus;
|
||||
import org.apache.hc.core5.http.ProtocolVersion;
|
||||
import org.apache.hc.core5.http.message.BasicClassicHttpRequest;
|
||||
import org.apache.hc.core5.http.message.BasicClassicHttpResponse;
|
||||
import org.apache.hc.core5.http.message.BasicHeader;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
public class TestCacheInvalidator {
|
||||
public class TestDefaultCacheInvalidator {
|
||||
|
||||
private CacheInvalidator impl;
|
||||
private DefaultCacheInvalidator impl;
|
||||
private HttpCacheStorage mockStorage;
|
||||
private HttpHost host;
|
||||
private CacheKeyGenerator cacheKeyGenerator;
|
||||
|
@ -78,7 +77,7 @@ public class TestCacheInvalidator {
|
|||
request = HttpTestUtils.makeDefaultRequest();
|
||||
response = HttpTestUtils.make200Response();
|
||||
|
||||
impl = new CacheInvalidator(cacheKeyGenerator, mockStorage);
|
||||
impl = new DefaultCacheInvalidator(cacheKeyGenerator, mockStorage);
|
||||
}
|
||||
|
||||
// Tests
|
||||
|
@ -205,7 +204,7 @@ public class TestCacheInvalidator {
|
|||
|
||||
@Test
|
||||
public void testInvalidatesHEADCacheEntryIfSubsequentGETRequestsAreMadeToTheSameURI() throws Exception {
|
||||
impl = new CacheInvalidator(cacheKeyGenerator, mockStorage);
|
||||
impl = new DefaultCacheInvalidator(cacheKeyGenerator, mockStorage);
|
||||
final String theURI = "http://foo.example.com:80/";
|
||||
request = new BasicClassicHttpRequest("GET", theURI);
|
||||
|
||||
|
@ -223,7 +222,7 @@ public class TestCacheInvalidator {
|
|||
|
||||
@Test
|
||||
public void testInvalidatesVariantHEADCacheEntriesIfSubsequentGETRequestsAreMadeToTheSameURI() throws Exception {
|
||||
impl = new CacheInvalidator(cacheKeyGenerator, mockStorage);
|
||||
impl = new DefaultCacheInvalidator(cacheKeyGenerator, mockStorage);
|
||||
final String theURI = "http://foo.example.com:80/";
|
||||
request = new BasicClassicHttpRequest("GET", theURI);
|
||||
final String theVariantKey = "{Accept-Encoding=gzip%2Cdeflate&User-Agent=Apache-HttpClient}";
|
||||
|
@ -258,7 +257,7 @@ public class TestCacheInvalidator {
|
|||
|
||||
@Test
|
||||
public void testDoesNotInvalidateHEADCacheEntryIfSubsequentHEADRequestsAreMadeToTheSameURI() throws Exception {
|
||||
impl = new CacheInvalidator(cacheKeyGenerator, mockStorage);
|
||||
impl = new DefaultCacheInvalidator(cacheKeyGenerator, mockStorage);
|
||||
final String theURI = "http://foo.example.com:80/";
|
||||
request = new BasicClassicHttpRequest("HEAD", theURI);
|
||||
|
||||
|
@ -272,7 +271,7 @@ public class TestCacheInvalidator {
|
|||
|
||||
@Test
|
||||
public void testDoesNotInvalidateGETCacheEntryIfSubsequentGETRequestsAreMadeToTheSameURI() throws Exception {
|
||||
impl = new CacheInvalidator(cacheKeyGenerator, mockStorage);
|
||||
impl = new DefaultCacheInvalidator(cacheKeyGenerator, mockStorage);
|
||||
final String theURI = "http://foo.example.com:80/";
|
||||
request = new BasicClassicHttpRequest("GET", theURI);
|
||||
|
Loading…
Reference in New Issue