Skip to content

Commit cc82d70

Browse files
authored
Merge pull request #184 from guoyingtao/RemoveCost
Removed totalCostLimit from MemoryConfig
2 parents a5d5af3 + 308bb89 commit cc82d70

File tree

3 files changed

+12
-5
lines changed

3 files changed

+12
-5
lines changed

Playgrounds/Storage.playground/playground.xcworkspace/contents.xcworkspacedata

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Source/Shared/Configuration/MemoryConfig.swift

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,17 @@ public struct MemoryConfig {
66
public let expiry: Expiry
77
/// The maximum number of objects in memory the cache should hold. 0 means no limit.
88
public let countLimit: UInt
9-
/// The maximum total cost that the cache can hold before it starts evicting objects. 0 means no limit.
10-
public let totalCostLimit: UInt
119

12-
public init(expiry: Expiry = .never, countLimit: UInt = 0, totalCostLimit: UInt = 0) {
10+
public init(expiry: Expiry = .never, countLimit: UInt = 0) {
1311
self.expiry = expiry
1412
self.countLimit = countLimit
15-
self.totalCostLimit = totalCostLimit
13+
}
14+
15+
// MARK: - Deprecated
16+
@available(*, deprecated,
17+
message: "Use init(expiry:countLimit:) instead.",
18+
renamed: "init(expiry:countLimit:)")
19+
public init(expiry: Expiry = .never, countLimit: UInt = 0, totalCostLimit: UInt = 0) {
20+
self.init(expiry: expiry, countLimit: countLimit)
1621
}
1722
}

Source/Shared/Storage/MemoryStorage.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ final class MemoryStorage {
1414
init(config: MemoryConfig) {
1515
self.config = config
1616
self.cache.countLimit = Int(config.countLimit)
17-
self.cache.totalCostLimit = Int(config.totalCostLimit)
1817
}
1918
}
2019

0 commit comments

Comments
 (0)