@Test public void dontReadFromMemoryCache() { int memoryPolicy = 0; memoryPolicy |= MemoryPolicy.NO_CACHE.index; assertThat(MemoryPolicy.shouldReadFromMemoryCache(memoryPolicy)).isFalse(); }
@Test public void readFromMemoryCache() { int memoryPolicy = 0; memoryPolicy |= MemoryPolicy.NO_STORE.index; assertThat(MemoryPolicy.shouldReadFromMemoryCache(memoryPolicy)).isTrue(); }
private void performRemoteViewInto(Request request, RemoteViewsAction action) { if (shouldReadFromMemoryCache(request.memoryPolicy)) { Bitmap bitmap = picasso.quickMemoryCacheCheck(action.request.key); if (bitmap != null) { action.complete(new RequestHandler.Result(bitmap, MEMORY)); return; } } if (placeholderResId != 0) { action.setImageResource(placeholderResId); } picasso.enqueueAndSubmit(action); } }
Result hunt() throws IOException { if (shouldReadFromMemoryCache(data.memoryPolicy)) { Bitmap bitmap = cache.get(key); if (bitmap != null) {
if (shouldReadFromMemoryCache(request.memoryPolicy)) { Bitmap bitmap = picasso.quickMemoryCacheCheck(request.key); if (bitmap != null) {
if (shouldReadFromMemoryCache(request.memoryPolicy)) { Bitmap bitmap = picasso.quickMemoryCacheCheck(request.key); if (bitmap != null) {
void resumeAction(Action action) { Bitmap bitmap = null; if (shouldReadFromMemoryCache(action.request.memoryPolicy)) { bitmap = quickMemoryCacheCheck(action.request.key); } if (bitmap != null) { // Resumed action is cached, complete immediately. deliverAction(new RequestHandler.Result(bitmap, MEMORY), action, null); if (loggingEnabled) { log(OWNER_MAIN, VERB_COMPLETED, action.request.logId(), "from " + MEMORY); } } else { // Re-submit the action to the executor. enqueueAndSubmit(action); if (loggingEnabled) { log(OWNER_MAIN, VERB_RESUMED, action.request.logId()); } } }
if (shouldReadFromMemoryCache(request.memoryPolicy)) { Bitmap bitmap = picasso.quickMemoryCacheCheck(request.key); if (bitmap != null) {