示例#1
0
 /**
  * Searches all keys in memory cache which are corresponded to incoming URI.<br>
  * <b>Note:</b> Memory cache can contain multiple sizes of the same image if only you didn't set
  * {@link ImageLoaderConfiguration.Builder#denyCacheImageMultipleSizesInMemory()
  * denyCacheImageMultipleSizesInMemory()} option in {@linkplain ImageLoaderConfiguration
  * configuration}
  */
 public static List<String> findCacheKeysForImageUri(
     String imageUri, MemoryCacheAware<String, Bitmap> memoryCache) {
   List<String> values = new ArrayList<String>();
   for (String key : memoryCache.keys()) {
     if (key.startsWith(imageUri)) {
       values.add(key);
     }
   }
   return values;
 }
示例#2
0
 /**
  * Removes from memory cache all images for incoming URI.<br>
  * <b>Note:</b> Memory cache can contain multiple sizes of the same image if only you didn't set
  * {@link ImageLoaderConfiguration.Builder#denyCacheImageMultipleSizesInMemory()
  * denyCacheImageMultipleSizesInMemory()} option in {@linkplain ImageLoaderConfiguration
  * configuration}
  */
 public static void removeFromCache(
     String imageUri, MemoryCacheAware<String, Bitmap> memoryCache) {
   List<String> keysToRemove = new ArrayList<String>();
   for (String key : memoryCache.keys()) {
     if (key.startsWith(imageUri)) {
       keysToRemove.add(key);
     }
   }
   for (String keyToRemove : keysToRemove) {
     memoryCache.remove(keyToRemove);
   }
 }