Package com.squareup.okhttp.internal.huc
Class CacheAdapter
- java.lang.Object
-
- com.squareup.okhttp.internal.huc.CacheAdapter
-
- All Implemented Interfaces:
InternalCache
public final class CacheAdapter extends Object implements InternalCache
AdaptsResponseCachetoInternalCache.
-
-
Constructor Summary
Constructors Constructor Description CacheAdapter(ResponseCache delegate)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Responseget(Request request)ResponseCachegetDelegate()CacheRequestput(Response response)voidremove(Request request)Remove any cache entries for the suppliedrequest.voidtrackConditionalCacheHit()Track an conditional GET that was satisfied by this cache.voidtrackResponse(CacheStrategy cacheStrategy)Track an HTTP response being satisfied withcacheStrategy.voidupdate(Response cached, Response network)Handles a conditional request hit by updating the stored cache response with the headers fromnetwork.
-
-
-
Constructor Detail
-
CacheAdapter
public CacheAdapter(ResponseCache delegate)
-
-
Method Detail
-
getDelegate
public ResponseCache getDelegate()
-
get
public Response get(Request request) throws IOException
- Specified by:
getin interfaceInternalCache- Throws:
IOException
-
put
public CacheRequest put(Response response) throws IOException
- Specified by:
putin interfaceInternalCache- Throws:
IOException
-
remove
public void remove(Request request) throws IOException
Description copied from interface:InternalCacheRemove any cache entries for the suppliedrequest. This is invoked when the client invalidates the cache, such as when making POST requests.- Specified by:
removein interfaceInternalCache- Throws:
IOException
-
update
public void update(Response cached, Response network) throws IOException
Description copied from interface:InternalCacheHandles a conditional request hit by updating the stored cache response with the headers fromnetwork. The cached response body is not updated. If the stored response has changed sincecachedwas returned, this does nothing.- Specified by:
updatein interfaceInternalCache- Throws:
IOException
-
trackConditionalCacheHit
public void trackConditionalCacheHit()
Description copied from interface:InternalCacheTrack an conditional GET that was satisfied by this cache.- Specified by:
trackConditionalCacheHitin interfaceInternalCache
-
trackResponse
public void trackResponse(CacheStrategy cacheStrategy)
Description copied from interface:InternalCacheTrack an HTTP response being satisfied withcacheStrategy.- Specified by:
trackResponsein interfaceInternalCache
-
-