/** * Returns a strategy to satisfy {@code request} using the a cached response {@code response}. */ public CacheStrategy get() { CacheStrategy candidate = getCandidate(); if (candidate.networkRequest != null && request.cacheControl().onlyIfCached()) { // We're forbidden from using the network and the cache is insufficient. return new CacheStrategy(null, null); } return candidate; }
return new CacheStrategy(request, null); return new CacheStrategy(request, null); if (!isCacheable(cacheResponse, request)) { return new CacheStrategy(request, null); return new CacheStrategy(request, null); builder.addHeader("Warning", "113 HttpURLConnection \"Heuristic expiration\""); return new CacheStrategy(null, builder.build()); ? new CacheStrategy(conditionalRequest, cacheResponse) : new CacheStrategy(conditionalRequest, null);
private void maybeCache() throws IOException { InternalCache responseCache = Internal.instance.internalCache(client); if (responseCache == null) return; // Should we cache this response for this request? if (!CacheStrategy.isCacheable(userResponse, networkRequest)) { if (HttpMethod.invalidatesCache(networkRequest.method())) { try { responseCache.remove(networkRequest); } catch (IOException ignored) { // The cache cannot be written. } } return; } // Offer this request to the cache. storeRequest = responseCache.put(stripBody(userResponse)); }
return new CacheStrategy(request, null); return new CacheStrategy(request, null); if (!isCacheable(cacheResponse, request)) { return new CacheStrategy(request, null); return new CacheStrategy(request, null); builder.addHeader("Warning", "113 HttpURLConnection \"Heuristic expiration\""); return new CacheStrategy(null, builder.build()); ? new CacheStrategy(conditionalRequest, cacheResponse) : new CacheStrategy(conditionalRequest, null);
private void maybeCache() throws IOException { InternalCache responseCache = Internal.instance.internalCache(client); if (responseCache == null) return; // Should we cache this response for this request? if (!CacheStrategy.isCacheable(userResponse, networkRequest)) { if (HttpMethod.invalidatesCache(networkRequest.method())) { try { responseCache.remove(networkRequest); } catch (IOException ignored) { // The cache cannot be written. } } return; } // Offer this request to the cache. storeRequest = responseCache.put(stripBody(userResponse)); }
return new CacheStrategy(request, null); return new CacheStrategy(request, null); if (!isCacheable(cacheResponse, request)) { return new CacheStrategy(request, null); return new CacheStrategy(request, null); builder.addHeader("Warning", "113 HttpURLConnection \"Heuristic expiration\""); return new CacheStrategy(null, builder.build()); ? new CacheStrategy(conditionalRequest, cacheResponse) : new CacheStrategy(conditionalRequest, null);
/** * Returns a strategy to satisfy {@code request} using the a cached response * {@code response}. */ public CacheStrategy get() { CacheStrategy candidate = getCandidate(); if (candidate.networkRequest != null && request.cacheControl().onlyIfCached()) { // We're forbidden from using the network and the cache is insufficient. return new CacheStrategy(null, null); } return candidate; }
private void maybeCache() throws IOException { InternalCache responseCache = Internal.instance.internalCache(client); if (responseCache == null) return; // Should we cache this response for this request? if (!CacheStrategy.isCacheable(userResponse, networkRequest)) { if (HttpMethod.invalidatesCache(networkRequest.method())) { try { responseCache.remove(networkRequest); } catch (IOException ignored) { // The cache cannot be written. } } return; } // Offer this request to the cache. storeRequest = responseCache.put(stripBody(userResponse)); }
/** * Returns a strategy to satisfy {@code request} using the a cached response * {@code response}. */ public CacheStrategy get() { CacheStrategy candidate = getCandidate(); if (candidate.networkRequest != null && request.cacheControl().onlyIfCached()) { // We're forbidden from using the network and the cache is insufficient. return new CacheStrategy(null, null); } return candidate; }