From f25edfd741297cb4bc62790b4d95ae1f10da81fd Mon Sep 17 00:00:00 2001 From: Eric Seidel Date: Wed, 15 Apr 2015 15:12:00 -0700 Subject: [PATCH] Revert "skyshell: disable cache for now" This reverts commit 9b03c575a4e12f80739d1de7d2c6d66a7cdb214a. https://codereview.chromium.org/999253005 I've not seen the stale caching behavior. I think we need to debug that and fix it. Living with out the cache causes very long load times in SkyShell. R=ianh@google.com Review URL: https://codereview.chromium.org/1086233002 --- .../src/org/domokit/oknet/NetworkServiceImpl.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/services/oknet/src/org/domokit/oknet/NetworkServiceImpl.java b/services/oknet/src/org/domokit/oknet/NetworkServiceImpl.java index ce30d856bad..f8b5b73d58b 100644 --- a/services/oknet/src/org/domokit/oknet/NetworkServiceImpl.java +++ b/services/oknet/src/org/domokit/oknet/NetworkServiceImpl.java @@ -45,9 +45,19 @@ public class NetworkServiceImpl implements NetworkService { if (sThreadPool == null) sThreadPool = Executors.newCachedThreadPool(); - if (sClient == null) + if (sClient == null) { sClient = new OkHttpClient(); + try { + int cacheSize = 10 * 1024 * 1024; // 10 MiB + File cacheDirectory = new File(context.getCacheDir(), "ok_http_cache"); + Cache cache = new Cache(cacheDirectory, cacheSize); + sClient.setCache(cache); + } catch (IOException e) { + Log.e(TAG, "Unable to create HTTP cache", e); + } + } + NetworkService.MANAGER.bind(this, pipe); }