public class HttpCache extends Object
ImageCacheHttpCache(Context) to init cachehttpGet(HttpRequest, HttpCacheListener)httpGet(String, HttpCacheListener)httpGet(HttpRequest)httpGet(String)httpGetString(HttpRequest)httpGetString(String)| 限定符和类型 | 类和说明 |
|---|---|
static class |
HttpCache.HttpCacheListener
HttpCacheListener, can do something before or after HttpGet
|
| 限定符和类型 | 字段和说明 |
|---|---|
static Executor |
THREAD_POOL_EXECUTOR
Default
Executor that be used to execute tasks in parallel. |
| 构造器和说明 |
|---|
HttpCache(android.content.Context context) |
| 限定符和类型 | 方法和说明 |
|---|---|
void |
clear()
Removes all elements from this cache, leaving it empty.
|
boolean |
containsKey(String url)
whether this cache contains the specified url.
|
HttpResponse |
getFromCache(String url)
get from memory cache first, if not exist in memory cache, get from db
|
HttpResponse |
httpGet(HttpRequest request)
http get
Attentions:
Don't call this on the ui thread, it may costs some times.
|
void |
httpGet(HttpRequest request,
HttpCache.HttpCacheListener listener)
http get
It gets data from cache or network asynchronous.
|
HttpResponse |
httpGet(String url)
http get
Attentions:
Don't call this on the ui thread, it may costs some times.
|
void |
httpGet(String url,
HttpCache.HttpCacheListener listener)
http get
It gets data from cache or network asynchronous.
|
HttpResponse |
httpGetString(HttpRequest httpRequest)
http get
Attentions:
Don't call this on the ui thread, it may costs some times.
|
String |
httpGetString(String url)
http get
Attentions:
Don't call this on the ui thread, it may costs some times.
|
protected boolean |
isExpired(String url)
whether the element of the specified url has invalided
|
public HttpResponse httpGet(HttpRequest request)
httpGet(HttpRequest, HttpCacheListener)httpRequest - public void httpGet(String url, HttpCache.HttpCacheListener listener)
httpGet(HttpRequest) or
httpGetString(HttpRequest)url - listener - listener which can do something before or after HttpGet. this can be null if you not want to do
somethingpublic void httpGet(HttpRequest request, HttpCache.HttpCacheListener listener)
httpGet(HttpRequest) or
httpGetString(HttpRequest)request - listener - listener which can do something before or after HttpGet. this can be null if you not want to do
somethingpublic HttpResponse httpGet(String url)
httpGet(HttpRequest, HttpCacheListener)url - public String httpGetString(String url)
httpGet(String, HttpCacheListener)url - public HttpResponse httpGetString(HttpRequest httpRequest)
httpGet(HttpRequest, HttpCacheListener)httpRequest - public boolean containsKey(String url)
url - protected boolean isExpired(String url)
url - public void clear()
public HttpResponse getFromCache(String url)
url - Copyright © 2012-2014. All Rights Reserved.