public final class OkResponseCacheAdapter extends Object implements OkResponseCache
| Constructor and Description |
|---|
OkResponseCacheAdapter(ResponseCache responseCache) |
| Modifier and Type | Method and Description |
|---|---|
CacheResponse |
get(URI uri,
String requestMethod,
Map<String,List<String>> requestHeaders) |
void |
maybeRemove(String requestMethod,
URI uri)
Remove any cache entries for the supplied
uri if the request method invalidates. |
CacheRequest |
put(URI uri,
URLConnection urlConnection) |
void |
trackConditionalCacheHit()
Track an conditional GET that was satisfied by this cache.
|
void |
trackResponse(ResponseSource source)
Track an HTTP response being satisfied by
source. |
void |
update(CacheResponse conditionalCacheHit,
HttpURLConnection connection)
Handles a conditional request hit by updating the stored cache response
with the headers from
httpConnection. |
public OkResponseCacheAdapter(ResponseCache responseCache)
public CacheResponse get(URI uri, String requestMethod, Map<String,List<String>> requestHeaders) throws IOException
get in interface OkResponseCacheIOExceptionpublic CacheRequest put(URI uri, URLConnection urlConnection) throws IOException
put in interface OkResponseCacheIOExceptionpublic void maybeRemove(String requestMethod, URI uri) throws IOException
OkResponseCacheuri if the request method invalidates.maybeRemove in interface OkResponseCacheIOExceptionpublic void update(CacheResponse conditionalCacheHit, HttpURLConnection connection) throws IOException
OkResponseCachehttpConnection. The cached response body is
not updated. If the stored response has changed since conditionalCacheHit was returned, this does nothing.update in interface OkResponseCacheIOExceptionpublic void trackConditionalCacheHit()
OkResponseCachetrackConditionalCacheHit in interface OkResponseCachepublic void trackResponse(ResponseSource source)
OkResponseCachesource.trackResponse in interface OkResponseCacheCopyright © 2014. All rights reserved.