/**
  * Clears both the memory and disk cache associated with this ImageCache object. Note that this
  * includes disk access so this should not be executed on the main/UI thread.
  */
 public void clearCache() {
   if (mMemoryCache != null) {
     mMemoryCache.evictAll();
     if (BuildConfig.DEBUG) {
       Log.d(TAG, "Memory cache cleared");
     }
   }
 }
  public List<String> recycleMemCachedBitmaps() {
    ArrayList<String> recycledUrls = new ArrayList<String>();
    /*Map<String, Bitmap> lruSnapshot = mLruCache.snapshot();
    Set<String> memCachedUrls = lruSnapshot.keySet();
    Bitmap bitmap;
    for(String url : memCachedUrls) {
    	bitmap = lruSnapshot.get(url);

    	if(bitmap != null && !bitmap.isRecycled()) {
    		recycledUrls.add(url);
    		bitmap.recycle();
    	}
    }*/
    mLruCache.evictAll();
    return recycledUrls;
  }
  /**
   * Clears both memory and disk cache associated with this ImageCache object. Note that this
   * includes disk access so this should not be executed on the main/UI thread.
   */
  public void clearCache() {
    if (mMemoryCache != null) {
      mMemoryCache.evictAll();
      if (BuildConfig.DEBUG) {
        Log.d(TAG, "Memory cache cleared!");
      }
    }

    synchronized (mDiskCacheLock) {
      mDiskCacheStarting = true; // clear完后变为true使得任何调用getBitmapFromDiskCache()都进入wait
      if (mDiskLruCache != null && !mDiskLruCache.isClosed()) {
        try {
          mDiskLruCache.delete();
        } catch (IOException e) {
          // TODO Auto-generated catch block
          Log.e(TAG, "clearCache---" + e);
        }
        mDiskLruCache = null;
        initDiskCache(); // clear完后还要记得init
      }
    }
  }
Exemple #4
0
  /**
   * Clears both the memory and disk cache associated with this ImageCache object. Note that this
   * includes disk access so this should not be executed on the main/UI thread.
   */
  public void clearCache() {
    if (mMemoryCache != null) {
      mMemoryCache.evictAll();
      if (BuildConfig.DEBUG) {
        Log.d(TAG, "Memory cache cleared");
      }
    }

    synchronized (mDiskCacheLock) {
      mDiskCacheStarting = true;
      if (mDiskLruCache != null && !mDiskLruCache.isClosed()) {
        try {
          mDiskLruCache.delete();
          if (BuildConfig.DEBUG) {
            Log.d(TAG, "Disk cache cleared");
          }
        } catch (IOException e) {
          Log.e(TAG, "clearCache - " + e);
        }
        mDiskLruCache = null;
        initDiskCache();
      }
    }
  }
 public void wipeImageCache() {
   coverCache.evictAll();
   thumbnailCache.evictAll();
 }
 public static void setCacheSize(int size) {
   synchronized (sThumbsCache) {
     sThumbsCache.evictAll();
     sThumbsCache = new LruCache<String, Bitmap>(size);
   }
 }
 public static void clear() {
   synchronized (sThumbsCache) {
     sThumbsCache.evictAll();
   }
 }
Exemple #8
0
 public void clearCaches() {
   mDiskCache.clearCache();
   mMemoryCache.evictAll();
 }
Exemple #9
0
 public void clearMemoryCache() {
   if (mMemoryCache != null) {
     mMemoryCache.evictAll();
   }
 }
Exemple #10
0
 public void releaseCache() {
   mMemoryCache.evictAll();
 }
Exemple #11
0
 /** 清空lrucache和软引用缓存 */
 public void clear() {
   mLruCache.evictAll();
   mSoftCache.clear();
 }
Exemple #12
0
 /** Clears the memory cache. */
 public void clearCache() {
   if (mMemoryCache != null) {
     mMemoryCache.evictAll();
     LOGD(TAG, "Memory cache cleared");
   }
 }