Browse Source

Make ‘cachePathBlock’ public

Yaroslav Zarichnyi 3 năm trước cách đây
mục cha
commit
1e5cc543e6
1 tập tin đã thay đổi với 7 bổ sung5 xóa
  1. 7 5
      Sources/Cache/DiskStorage.swift

+ 7 - 5
Sources/Cache/DiskStorage.swift

@@ -457,16 +457,18 @@ extension DiskStorage {
         /// If set to `true`, image extension will be extracted from original file name and append to
         /// the hased file name and used as the cache key on disk.
         public var autoExtAfterHashedFileName = false
+        
+        /// Closure that takes in initial directory path and generates
+        /// the final disk cache path. You can use it to fully customize your cache path.
+        public var cachePathBlock: ((_ directory: URL, _ cacheName: String) -> URL)! = {
+            (directory, cacheName) in
+            return directory.appendingPathComponent(cacheName, isDirectory: true)
+        }
 
         let name: String
         let fileManager: FileManager
         let directory: URL?
 
-        var cachePathBlock: ((_ directory: URL, _ cacheName: String) -> URL)! = {
-            (directory, cacheName) in
-            return directory.appendingPathComponent(cacheName, isDirectory: true)
-        }
-
         /// Creates a config value based on given parameters.
         ///
         /// - Parameters: