public abstract class BaseCachePolicy<T> extends java.lang.Object implements CachePolicy<T>
| 限定符和类型 | 字段和说明 |
|---|---|
protected CacheEntity<T> |
cacheEntity |
protected boolean |
canceled |
protected int |
currentRetryCount |
protected boolean |
executed |
protected Callback<T> |
mCallback |
protected Call |
rawCall |
protected Request<T,? extends Request> |
request |
| 构造器和说明 |
|---|
BaseCachePolicy(Request<T,? extends Request> request) |
| 限定符和类型 | 方法和说明 |
|---|---|
void |
cancel()
取消请求
|
boolean |
isCanceled()
是否已经取消
|
boolean |
isExecuted()
当前请求是否已经执行
|
boolean |
onAnalysisResponse(Call call,
okhttp3.Response response)
控制是否执行后续的回调动作
|
CacheEntity<T> |
prepareCache()
构建缓存
|
Call |
prepareRawCall()
构建请求对象
|
protected void |
requestNetworkAsync() |
protected Response<T> |
requestNetworkSync() |
protected void |
runOnUiThread(java.lang.Runnable run) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitonError, onSuccess, requestAsync, requestSyncprotected volatile boolean canceled
protected volatile int currentRetryCount
protected boolean executed
protected Call rawCall
protected CacheEntity<T> cacheEntity
public boolean onAnalysisResponse(Call call,
okhttp3.Response response)
CachePolicyonAnalysisResponse 在接口中 CachePolicy<T>call - 请求的对象response - 响应的对象public CacheEntity<T> prepareCache()
CachePolicyprepareCache 在接口中 CachePolicy<T>public Call prepareRawCall()
throws java.lang.Throwable
CachePolicyprepareRawCall 在接口中 CachePolicy<T>java.lang.Throwableprotected void requestNetworkAsync()
protected void runOnUiThread(java.lang.Runnable run)
public boolean isExecuted()
CachePolicyisExecuted 在接口中 CachePolicy<T>public void cancel()
CachePolicycancel 在接口中 CachePolicy<T>public boolean isCanceled()
CachePolicyisCanceled 在接口中 CachePolicy<T>