Ejemplo n.º 1
0
 private void refreshOkHttpCacheStats() {
   Cache cache = client.getCache(); // Shares the cache with apiClient, so no need to check both.
   int writeTotal = cache.getWriteSuccessCount() + cache.getWriteAbortCount();
   int percentage = (int) ((1f * cache.getWriteAbortCount() / writeTotal) * 100);
   okHttpCacheWriteErrorView.setText(
       cache.getWriteAbortCount() + " / " + writeTotal + " (" + percentage + "%)");
   okHttpCacheRequestCountView.setText(String.valueOf(cache.getRequestCount()));
   okHttpCacheNetworkCountView.setText(String.valueOf(cache.getNetworkCount()));
   okHttpCacheHitCountView.setText(String.valueOf(cache.getHitCount()));
 }