Browse Source

Merge pull request #1145 from FrainL/fix-immediately-expire

Fix cache immediately expire when setting maxCachePeriodInSecond to negative
Wei Wang 6 years ago
parent
commit
47e1b86430
1 changed files with 1 additions and 1 deletions
  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.")