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 OkResponseCache
IOException
public CacheRequest put(URI uri, URLConnection urlConnection) throws IOException
put
in interface OkResponseCache
IOException
public void maybeRemove(String requestMethod, URI uri) throws IOException
OkResponseCache
uri
if the request method invalidates.maybeRemove
in interface OkResponseCache
IOException
public void update(CacheResponse conditionalCacheHit, HttpURLConnection connection) throws IOException
OkResponseCache
httpConnection
. The cached response body is
not updated. If the stored response has changed since conditionalCacheHit
was returned, this does nothing.update
in interface OkResponseCache
IOException
public void trackConditionalCacheHit()
OkResponseCache
trackConditionalCacheHit
in interface OkResponseCache
public void trackResponse(ResponseSource source)
OkResponseCache
source
.trackResponse
in interface OkResponseCache
Copyright © 2014. All rights reserved.