diff --git a/Playgrounds/Storage.playground/playground.xcworkspace/contents.xcworkspacedata b/Playgrounds/Storage.playground/playground.xcworkspace/contents.xcworkspacedata index 94b2795e..919434a6 100644 --- a/Playgrounds/Storage.playground/playground.xcworkspace/contents.xcworkspacedata +++ b/Playgrounds/Storage.playground/playground.xcworkspace/contents.xcworkspacedata @@ -1,4 +1,7 @@ + + diff --git a/Source/Shared/Configuration/MemoryConfig.swift b/Source/Shared/Configuration/MemoryConfig.swift index fedf6d88..62bdfbdb 100644 --- a/Source/Shared/Configuration/MemoryConfig.swift +++ b/Source/Shared/Configuration/MemoryConfig.swift @@ -6,12 +6,17 @@ public struct MemoryConfig { public let expiry: Expiry /// The maximum number of objects in memory the cache should hold. 0 means no limit. public let countLimit: UInt - /// The maximum total cost that the cache can hold before it starts evicting objects. 0 means no limit. - public let totalCostLimit: UInt - public init(expiry: Expiry = .never, countLimit: UInt = 0, totalCostLimit: UInt = 0) { + public init(expiry: Expiry = .never, countLimit: UInt = 0) { self.expiry = expiry self.countLimit = countLimit - self.totalCostLimit = totalCostLimit + } + + // MARK: - Deprecated + @available(*, deprecated, + message: "Use init(expiry:countLimit:) instead.", + renamed: "init(expiry:countLimit:)") + public init(expiry: Expiry = .never, countLimit: UInt = 0, totalCostLimit: UInt = 0) { + self.init(expiry: expiry, countLimit: countLimit) } } diff --git a/Source/Shared/Storage/MemoryStorage.swift b/Source/Shared/Storage/MemoryStorage.swift index c72cfd30..bb481389 100644 --- a/Source/Shared/Storage/MemoryStorage.swift +++ b/Source/Shared/Storage/MemoryStorage.swift @@ -14,7 +14,6 @@ final class MemoryStorage { init(config: MemoryConfig) { self.config = config self.cache.countLimit = Int(config.countLimit) - self.cache.totalCostLimit = Int(config.totalCostLimit) } }