I want to use server cache for 15 minutess so what i have to use in setRequestProperty() ?
Please Help me..
Here is my code which i used..
private HttpURLConnection httpCon = null;
httpCon = (HttpURLConnection) httpUrl.openConnection();
httpCon.setRequestMethod("GET");
httpCon.setRequestProperty("Connection", "Keep-Alive");
httpCon.setRequestProperty("Pragma","public");
httpCon.setRequestProperty("Cache-Control","maxage=900");
httpCon.setUseCaches(true);
You are telling the server you are willing for it to cache responses, but there’s no guarantee that the server will do that or is enabled to do that (unless you control the server also and implement that).
You can also try setting up an intermediate HTTP cache the client and server, such as a proxy cache such as Varnish, Pound, or Squid.
Lastly, you can do browser caching on your own, which is supported the the Android java.net package but doesn’t have a default implementation. To do this:
-Check out HttpURLConnection which details (in the “Response Caching” section) that you must implement ResponseCache and call setDefault.
-Also check out ResponseCache Example which has examples of this, and something quirky to watch out for at the end (which may or may not still be true).
Good luck!