Better method name (no functional changes)
This commit is contained in:
parent
7cf4240b3f
commit
f16ac3ec3b
|
@ -197,7 +197,7 @@ class BasicHttpAsyncCache implements HttpAsyncCache {
|
|||
final HttpCacheEntry entry,
|
||||
final FutureCallback<Boolean> callback) {
|
||||
final String variantKey = cacheKeyGenerator.generateVariantKey(req, entry);
|
||||
final String variantCacheKey = cacheKeyGenerator.generateVariantURI(host, req, entry);
|
||||
final String variantCacheKey = cacheKeyGenerator.generateKey(host, req, entry);
|
||||
return storage.putEntry(variantCacheKey, entry, new FutureCallback<Boolean>() {
|
||||
|
||||
@Override
|
||||
|
|
|
@ -151,7 +151,7 @@ class BasicHttpCache implements HttpCache {
|
|||
final HttpRequest req,
|
||||
final HttpCacheEntry entry) {
|
||||
final String variantKey = cacheKeyGenerator.generateVariantKey(req, entry);
|
||||
final String variantCacheKey = cacheKeyGenerator.generateVariantURI(host, req, entry);
|
||||
final String variantCacheKey = cacheKeyGenerator.generateKey(host, req, entry);
|
||||
storeEntry(variantCacheKey, entry);
|
||||
try {
|
||||
storage.updateEntry(cacheKey, new HttpCacheCASOperation() {
|
||||
|
|
|
@ -119,7 +119,7 @@ public class CacheKeyGenerator implements Resolver<URI, String> {
|
|||
* @param entry the parent entry used to track the variants
|
||||
* @return cache key
|
||||
*/
|
||||
public String generateVariantURI(final HttpHost host, final HttpRequest request, final HttpCacheEntry entry) {
|
||||
public String generateKey(final HttpHost host, final HttpRequest request, final HttpCacheEntry entry) {
|
||||
if (!entry.hasVariants()) {
|
||||
return generateKey(host, request);
|
||||
}
|
||||
|
|
|
@ -146,7 +146,7 @@ class DefaultAsyncCacheRevalidator extends CacheRevalidatorBase {
|
|||
final AsyncExecChain chain,
|
||||
final AsyncExecCallback asyncExecCallback,
|
||||
final HttpCacheEntry entry) {
|
||||
final String cacheKey = cacheKeyGenerator.generateVariantURI(target, request, entry);
|
||||
final String cacheKey = cacheKeyGenerator.generateKey(target, request, entry);
|
||||
scheduleRevalidation(cacheKey, new Runnable() {
|
||||
|
||||
@Override
|
||||
|
|
|
@ -81,7 +81,7 @@ class DefaultCacheRevalidator extends CacheRevalidatorBase {
|
|||
final ExecChain.Scope scope,
|
||||
final ExecChain chain,
|
||||
final HttpCacheEntry entry) {
|
||||
final String cacheKey = cacheKeyGenerator.generateVariantURI(target, request, entry);
|
||||
final String cacheKey = cacheKeyGenerator.generateKey(target, request, entry);
|
||||
scheduleRevalidation(cacheKey, new Runnable() {
|
||||
|
||||
@Override
|
||||
|
|
|
@ -127,7 +127,7 @@ public class TestCacheKeyGenerator {
|
|||
}
|
||||
};
|
||||
|
||||
final String result = extractor.generateVariantURI(defaultHost, mockRequest, mockEntry);
|
||||
final String result = extractor.generateKey(defaultHost, mockRequest, mockEntry);
|
||||
verify(mockEntry).hasVariants();
|
||||
Assert.assertSame(theURI, result);
|
||||
}
|
||||
|
@ -150,7 +150,7 @@ public class TestCacheKeyGenerator {
|
|||
when(mockEntry.headerIterator("Vary")).thenReturn(new BasicHeaderIterator(varyHeaders, "Vary"));
|
||||
when(mockRequest.getHeaders("Accept-Encoding")).thenReturn(encHeaders);
|
||||
|
||||
final String result = extractor.generateVariantURI(defaultHost, mockRequest, mockEntry);
|
||||
final String result = extractor.generateKey(defaultHost, mockRequest, mockEntry);
|
||||
|
||||
verify(mockEntry).hasVariants();
|
||||
verify(mockEntry).headerIterator("Vary");
|
||||
|
@ -176,7 +176,7 @@ public class TestCacheKeyGenerator {
|
|||
when(mockRequest.getHeaders("Accept-Encoding"))
|
||||
.thenReturn(noHeaders);
|
||||
|
||||
final String result = extractor.generateVariantURI(defaultHost, mockRequest, mockEntry);
|
||||
final String result = extractor.generateKey(defaultHost, mockRequest, mockEntry);
|
||||
|
||||
verify(mockEntry).hasVariants();
|
||||
verify(mockEntry).headerIterator("Vary");
|
||||
|
@ -203,7 +203,7 @@ public class TestCacheKeyGenerator {
|
|||
when(mockRequest.getHeaders("Accept-Encoding")).thenReturn(encHeaders);
|
||||
when(mockRequest.getHeaders("User-Agent")).thenReturn(uaHeaders);
|
||||
|
||||
final String result = extractor.generateVariantURI(defaultHost, mockRequest, mockEntry);
|
||||
final String result = extractor.generateKey(defaultHost, mockRequest, mockEntry);
|
||||
|
||||
verify(mockEntry).hasVariants();
|
||||
verify(mockEntry).headerIterator("Vary");
|
||||
|
@ -232,7 +232,7 @@ public class TestCacheKeyGenerator {
|
|||
when(mockRequest.getHeaders("Accept-Encoding")).thenReturn(encHeaders);
|
||||
when(mockRequest.getHeaders("User-Agent")).thenReturn(uaHeaders);
|
||||
|
||||
final String result = extractor.generateVariantURI(defaultHost, mockRequest, mockEntry);
|
||||
final String result = extractor.generateKey(defaultHost, mockRequest, mockEntry);
|
||||
|
||||
verify(mockEntry).hasVariants();
|
||||
verify(mockEntry).headerIterator("Vary");
|
||||
|
@ -261,7 +261,7 @@ public class TestCacheKeyGenerator {
|
|||
when(mockRequest.getHeaders("Accept-Encoding")).thenReturn(encHeaders);
|
||||
when(mockRequest.getHeaders("User-Agent")).thenReturn(uaHeaders);
|
||||
|
||||
final String result = extractor.generateVariantURI(defaultHost, mockRequest, mockEntry);
|
||||
final String result = extractor.generateKey(defaultHost, mockRequest, mockEntry);
|
||||
|
||||
verify(mockEntry).hasVariants();
|
||||
verify(mockEntry).headerIterator("Vary");
|
||||
|
|
Loading…
Reference in New Issue