Explorar el Código

fix cache immediately expire when setting maxCachePeriodInSecond to negative

Frain hace 6 años
padre
commit
162602a234
Se han modificado 1 ficheros con 1 adiciones y 1 borrados
  1. 1 1
      Sources/General/Deprecated.swift

+ 1 - 1
Sources/General/Deprecated.swift

@@ -407,7 +407,7 @@ extension ImageCache {
     @available(*, deprecated, message: "Deprecated. Use `diskStorage.config.expiration` instead")
     open var maxCachePeriodInSecond: TimeInterval {
         get { return diskStorage.config.expiration.timeInterval }
-        set { diskStorage.config.expiration = .seconds(newValue) }
+        set { diskStorage.config.expiration = newValue > 0 ? .seconds(newValue) : .never }
     }
 
     @available(*, deprecated, message: "Use `Result` based callback instead.")