public final class CacheAdapter extends Object implements InternalCache
ResponseCache to InternalCache.| Constructor and Description |
|---|
CacheAdapter(ResponseCache delegate) |
| Modifier and Type | Method and Description |
|---|---|
Response |
get(Request request) |
ResponseCache |
getDelegate() |
CacheRequest |
put(Response response) |
void |
remove(Request request)
Remove any cache entries for the supplied
request. |
void |
trackConditionalCacheHit()
Track an conditional GET that was satisfied by this cache.
|
void |
trackResponse(CacheStrategy cacheStrategy)
Track an HTTP response being satisfied with
cacheStrategy. |
void |
update(Response cached,
Response network)
Handles a conditional request hit by updating the stored cache response
with the headers from
network. |
public CacheAdapter(ResponseCache delegate)
public ResponseCache getDelegate()
public Response get(Request request) throws IOException
get in interface InternalCacheIOExceptionpublic CacheRequest put(Response response) throws IOException
put in interface InternalCacheIOExceptionpublic void remove(Request request) throws IOException
InternalCacherequest. This is invoked
when the client invalidates the cache, such as when making POST requests.remove in interface InternalCacheIOExceptionpublic void update(Response cached, Response network) throws IOException
InternalCachenetwork. The cached response body is not
updated. If the stored response has changed since cached was
returned, this does nothing.update in interface InternalCacheIOExceptionpublic void trackConditionalCacheHit()
InternalCachetrackConditionalCacheHit in interface InternalCachepublic void trackResponse(CacheStrategy cacheStrategy)
InternalCachecacheStrategy.trackResponse in interface InternalCache