Class OkResponseCacheAdapter
java.lang.Object
com.squareup.okhttp.internal.http.OkResponseCacheAdapter
- All Implemented Interfaces:
OkResponseCache
public final class OkResponseCacheAdapter extends Object implements OkResponseCache
-
Constructor Summary
Constructors Constructor Description OkResponseCacheAdapter(ResponseCache responseCache) -
Method Summary
Modifier and Type Method Description CacheResponseget(URI uri, String requestMethod, Map<String,List<String>> requestHeaders)voidmaybeRemove(String requestMethod, URI uri)Remove any cache entries for the supplieduriif the request method invalidates.CacheRequestput(URI uri, URLConnection urlConnection)voidtrackConditionalCacheHit()Track an conditional GET that was satisfied by this cache.voidtrackResponse(ResponseSource source)Track an HTTP response being satisfied bysource.voidupdate(CacheResponse conditionalCacheHit, HttpURLConnection connection)Handles a conditional request hit by updating the stored cache response with the headers fromhttpConnection.
-
Constructor Details
-
OkResponseCacheAdapter
-
-
Method Details
-
get
public CacheResponse get(URI uri, String requestMethod, Map<String,List<String>> requestHeaders) throws IOException- Specified by:
getin interfaceOkResponseCache- Throws:
IOException
-
put
- Specified by:
putin interfaceOkResponseCache- Throws:
IOException
-
maybeRemove
Description copied from interface:OkResponseCacheRemove any cache entries for the supplieduriif the request method invalidates.- Specified by:
maybeRemovein interfaceOkResponseCache- Throws:
IOException
-
update
public void update(CacheResponse conditionalCacheHit, HttpURLConnection connection) throws IOExceptionDescription copied from interface:OkResponseCacheHandles a conditional request hit by updating the stored cache response with the headers fromhttpConnection. The cached response body is not updated. If the stored response has changed sinceconditionalCacheHitwas returned, this does nothing.- Specified by:
updatein interfaceOkResponseCache- Throws:
IOException
-
trackConditionalCacheHit
public void trackConditionalCacheHit()Description copied from interface:OkResponseCacheTrack an conditional GET that was satisfied by this cache.- Specified by:
trackConditionalCacheHitin interfaceOkResponseCache
-
trackResponse
Description copied from interface:OkResponseCacheTrack an HTTP response being satisfied bysource.- Specified by:
trackResponsein interfaceOkResponseCache
-