@Override public <T> byte[] getFromCache(Request request) { String cacheKey = urlToKey(request.url().url()); byte[] memoryResponse = (byte[]) memoryCache.get(cacheKey); if(memoryResponse != null){ Log.d("SmartCall", "Memory "); return memoryResponse; } try { DiskLruCache.Snapshot cacheSnapshot = diskCache.get(cacheKey); if(cacheSnapshot != null){ Log.d("SmartCall", "Disk "); return cacheSnapshot.getString(0).getBytes(); }else{ Log.d("SmartCall", "Disk hit!"); return null; } }catch(IOException exc){ return null; } }
@Override public <T> byte[] getFromCache(Request request) { String cacheKey = urlToKey(request.url().url()); byte[] memoryResponse = (byte[]) memoryCache.get(cacheKey); if(memoryResponse != null){ Log.d("SmartCall", "Memory hit!"); return memoryResponse; } try { DiskLruCache.Snapshot cacheSnapshot = diskCache.get(cacheKey); if(cacheSnapshot != null){ Log.d("SmartCall", "Disk hit!"); return cacheSnapshot.getString(0).getBytes(); }else{ return null; } }catch(IOException exc){ return null; } }
@Override public <T> byte[] getFromCache(Request request) { String cacheKey = urlToKey(request.url().url()); byte[] memoryResponse = (byte[]) memoryCache.get(cacheKey); if(memoryResponse != null){ Log.d("SmartCall", "Memory hit!"); return memoryResponse; } try { DiskLruCache.Snapshot cacheSnapshot = diskCache.get(cacheKey); if(cacheSnapshot != null){ Log.d("SmartCall", "Disk hit!"); return cacheSnapshot.getString(0).getBytes(); }else{ return null; } }catch(IOException exc){ return null; } }
loggerHelper.logEntryForKeyIsOnDisk(key); try { diskResult = snapshotObject.getString(0); } catch (IOException e) { logger.logError(e);
loggerHelper.logEntryForKeyIsOnDisk(key); try { diskResult = snapshotObject.getString(0); } catch (IOException e) { logger.logError(e);
String storedLength = snapshot.getString(0); if (!TextUtils.isEmpty(storedLength)) { length = Long.parseLong(storedLength);