CacheEntry previous = cache.get(uri);
if (previous!=null && previous.isValid())
return previous.getResponse();
if (previous!=null)
previous.prepareConditionalGet(request);
HttpResponse response = chain.execute(request, context); // call the chain
if (response.getStatusLine().getStatusCode()==304) // not modified
return previous.updateCacheValues(response).getResponse();