Skip to content

Commit edd2ee5

Browse files
committed
support cache-control is no-cache in http request
1 parent ed57a3f commit edd2ee5

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/cn/trinea/android/common/service/HttpCache.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
import android.content.Context;
88
import android.os.AsyncTask;
9+
import cn.trinea.android.common.constant.HttpConstants;
910
import cn.trinea.android.common.dao.HttpCacheDao;
1011
import cn.trinea.android.common.dao.impl.HttpCacheDaoImpl;
1112
import cn.trinea.android.common.entity.HttpRequest;
@@ -101,7 +102,10 @@ public HttpResponse httpGet(HttpRequest request) {
101102
return null;
102103
}
103104

104-
HttpResponse cacheResponse = getFromCache(url);
105+
HttpResponse cacheResponse = null;
106+
if (!"no-cache".equals(request.getRequestProperty(HttpConstants.CACHE_CONTROL))) {
107+
cacheResponse = getFromCache(url);
108+
}
105109
return cacheResponse == null ? putIntoCache(HttpUtils.httpGet(url)) : cacheResponse;
106110
}
107111

0 commit comments

Comments
 (0)