private static void removeStaleCache() { for (Map.Entry<String, CacheData> entry : InfoCache.lruCache.snapshot().entrySet()) { final CacheData data = entry.getValue(); if (data != null && data.isExpired()) { InfoCache.lruCache.remove(entry.getKey()); } } }
public void removeInfo(int serviceId, @NonNull String url) { if (DEBUG) Log.d(TAG, "removeInfo() called with: serviceId = [" + serviceId + "], url = [" + url + "]"); synchronized (lruCache) { lruCache.remove(keyOf(serviceId, url)); } }
@Nullable private static Info getInfo(@NonNull final String key) { final CacheData data = InfoCache.lruCache.get(key); if (data == null) return null; if (data.isExpired()) { InfoCache.lruCache.remove(key); return null; } return data.info; }
@Nullable public <T> T take(@NonNull final String key, @NonNull final Class<T> type) { if (DEBUG) Log.d(TAG, "take() called with: key = [" + key + "]"); synchronized (lruCache) { return lruCache.get(key) != null ? getItem(lruCache.remove(key), type) : null; } }
@Override public void remove(String key) { if (cache.get(key) != null) { cache.remove(key); } }
@Override public synchronized void put(String key, Object value) { if (TextUtils.isEmpty(key)) return; if (cache.get(key) != null) { cache.remove(key); } cache.put(key, value); }
/** * 移除缓存 * @param url */ public void removeBitmapCache(String url) { if (url != null && mCache != null) { Bitmap bm = mCache.remove(url); if (bm != null) { bm.recycle(); } } }
public void removeObjectFromCache(String key) { if (key.isEmpty()) { return; } // Remove from memory cache if (bufferCache != null) { bufferCache.remove(key); } }
/** * 移除缓存 */ public synchronized void removeImageCache(String key) { if (key != null) { if (mMemoryCache != null) { Bitmap bm = mMemoryCache.remove(key); if (bm != null) { bm.recycle(); } } } }
@Override public void clearLastNetworkState(Object object) { cache.remove(object.toString()); }
@Override public void evict(String key) { cache.remove(key); timestampMap.remove(key); expireTimeMap.remove(key); }
public synchronized Bitmap getBitmap(int index) { String key = "index:" + index; final Bitmap b = mMemCache.get(key); if (b == null) { Log.w(TAG, "getNextBitmap is null. remove from cache"); mMemCache.remove(key); return null; } return b; }
public void recycleAllBitmaps() { for (String string : lis) { Bitmap tmp = mLruCaches.get(string); if (tmp != null && !tmp.isRecycled()) { tmp.recycle(); } mLruCaches.remove(string); } } }
static synchronized <T extends Model> void removeEntity(T entity) { sCache.remove(getEntityIdentifier(entity.getClass(), entity.id)); }
public static synchronized void removeEntity(Model entity) { sEntities.remove(getIdentifier(entity)); }
public static synchronized void removeEntity(Model entity) { sEntities.remove(getIdentifier(entity)); }
/** * Get a value from the cache * * @return the cached value if it is still valid, else null. */ synchronized public V get(K key) { final Pair<V, Long> cachePair = lruCache.get(key); if (cachePair != null && cachePair.first != null) { if (cachePair.second > System.currentTimeMillis()) { return cachePair.first; } else { lruCache.remove(key); } } return null; }
public static synchronized void removeEntity(Model entity) { sEntities.remove(getIdentifier(entity)); }