Просмотр исходного кода

Add option to remove image only from disk cache and not memory

kt 8 лет назад
Родитель
Сommit
f45e01c563
1 измененных файлов с 5 добавлено и 1 удалено
  1. 5 1
      Sources/ImageCache.swift

+ 5 - 1
Sources/ImageCache.swift

@@ -239,11 +239,15 @@ open class ImageCache {
     */
     open func removeImage(forKey key: String,
                           processorIdentifier identifier: String = "",
+                          fromMemory: Bool = true,
                           fromDisk: Bool = true,
                           completionHandler: (() -> Void)? = nil)
     {
         let computedKey = key.computedKey(with: identifier)
-        memoryCache.removeObject(forKey: computedKey as NSString)
+
+        if fromMemory {
+            memoryCache.removeObject(forKey: computedKey as NSString)
+        }
         
         func callHandlerInMainQueue() {
             if let handler = completionHandler {