/** * Commits this edit so it is visible to readers. This releases the * edit lock so another edit may be started on the same key. */ public void commit() throws IOException { if (hasErrors) { completeEdit(this, false); remove(entry.key); // The previous entry is stale. } else { completeEdit(this, true); } committed = true; }
private void trimToSize() throws IOException { while (size > maxSize) { Map.Entry<String, Entry> toEvict = lruEntries.entrySet().iterator().next(); remove(toEvict.getKey()); } }
@Override public Bitmap remove(String key) { try { mDiskCache.remove(key); } catch (IOException e) { // no op } return null; }
/** * Removes the entry for {@code url} from all enabled caches, if it exists. <p/> If you have the * disk cache enabled, you should not call this method from main/UI thread. */ public void remove(String url) { if (null != mMemoryCache) { mMemoryCache.remove(url); } if (null != mDiskCache) { checkNotOnMainThread(); try { mDiskCache.remove(transformUrlForDiskCacheKey(url)); scheduleDiskCacheFlush(); } catch (IOException e) { e.printStackTrace(); } } }
mDiskCache.remove(key); scheduleDiskCacheFlush();
@Override protected boolean doRemove(String key) { if (mDiskLruCache == null) { return false; } try { return mDiskLruCache.remove(key); } catch (IOException e) { e.printStackTrace(); } return false; }
private void removeFromDiskQuietly(String key) { if (mDiskCache == null) { return; } try { mDiskCache.remove(key); } catch (IOException e) { System.out.println("Unable to remove entry from disk cache. key: " + key); } }
@Override public boolean removeCache(String url) { try { LogUtils.i(TAG, "remove cache : url " + url); return mDiskCache.remove(CacheHelper.getInstance().urlToKey(url)); } catch (IOException e) { e.printStackTrace(); return false; } }
/** * Removes the entry for {@code url} from disk cache, if it exists. <p/> You should not call this method from main/UI thread. */ public void removeFromDiskCache(String url) { if (null != mDiskCache) { checkNotOnMainThread(); try { mDiskCache.remove(transformUrlForDiskCacheKey(url)); scheduleDiskCacheFlush(); } catch (IOException e) { e.printStackTrace(); } } }
/** * Removes the entry for {@code url} from all enabled caches, if it exists. <p/> If you have the * disk cache enabled, you should not call this method from main/UI thread. */ public void remove(String url) { if (null != mMemoryCache) { synchronized (mMemoryCache) { mMemoryCache.remove(url); } } if (null != mDiskCache) { checkNotOnMainThread(); try { mDiskCache.remove(transformUrlForDiskCacheKey(url)); scheduleDiskCacheFlush(); } catch (IOException e) { e.printStackTrace(); } } }
LogUtils.e(TAG, e.getMessage()); try { mDiskCache.remove(key); } catch (IOException e1) { e1.printStackTrace();
diskCache.remove(urlToDiskCacheKey(albumUrl)); Log.d("KDE/Mpris/AlbumArtCache", "Invalid image: " + albumUrl);
mDiskCache.remove(key); scheduleDiskCacheFlush();
/** * Delete the corresponding object in cache. * * @param key is the key of the object. */ public void delete(String key) { if (!ramMode.equals(DualCacheRamMode.DISABLE)) { ramCacheLru.remove(key); } if (!diskMode.equals(DualCacheDiskMode.DISABLE)) { try { dualCacheLock.lockDiskEntryWrite(key); diskLruCache.remove(key); } catch (IOException e) { logger.logError(e); } finally { dualCacheLock.unLockDiskEntryWrite(key); } } }
/** * Delete the corresponding object in cache. * * @param key is the key of the object. */ public void delete(String key) { if (!ramMode.equals(DualCacheRamMode.DISABLE)) { ramCacheLru.remove(key); } if (!diskMode.equals(DualCacheDiskMode.DISABLE)) { try { dualCacheLock.lockDiskEntryWrite(key); diskLruCache.remove(key); } catch (IOException e) { logger.logError(e); } finally { dualCacheLock.unLockDiskEntryWrite(key); } } }