Android OkHttp : Why I get the same response -


when use okhttp json url :

request request = new request.builder()             .url(url).build(); 

i same response (sometimes can new response).

if use this:

request request = new request.builder()             .cachecontrol(new cachecontrol.builder().nocache().nostore().build())             .url(url).build(); 

i new response everytime.

i want know why same reponse first method?

caching in http

http typically used distributed information systems, performance can improved use of response caches. http/1.1 protocol includes number of elements intended make caching work possible. because these elements inextricable other aspects of protocol, , because interact each other, useful describe basic caching design of http separately detailed descriptions of methods, headers, response codes, etc.

caching useless if did not improve performance. goal of caching in http/1.1 eliminate need send requests in many cases, , eliminate need send full responses in many other cases. former reduces number of network round-trips required many operations; use "expiration" mechanism purpose. latter reduces network bandwidth requirements.

for more information on this, go through caching in http. on coding aspect, go through documentation on class cache.


Popular posts from this blog