private synchronized void trackResponse(CacheStrategy cacheStrategy) { this.requestCount++; if (cacheStrategy.networkRequest != null) { this.networkCount++; } else if (cacheStrategy.cacheResponse != null) { this.hitCount++; } }
private synchronized void trackResponse(CacheStrategy cacheStrategy) { requestCount++; if (cacheStrategy.networkRequest != null) { // If this is a conditional request, we'll increment hitCount if/when it hits. networkCount++; } else if (cacheStrategy.cacheResponse != null) { // This response uses the cache and not the network. That's a cache hit. hitCount++; } }
@Override public void trackResponse(CacheStrategy cacheStrategy) { Cache.this.trackResponse(cacheStrategy); }
/** Track an HTTP response being satisfied with {@code cacheStrategy}. */ void trackResponse(CacheStrategy cacheStrategy);
@Override public void trackResponse(CacheStrategy cacheStrategy) { // This method is optional. }
void trackResponse(CacheStrategy cacheStrategy);