Skip to content

Commit

Permalink
Merge pull request #184 from guoyingtao/RemoveCost
Browse files Browse the repository at this point in the history
Removed totalCostLimit from MemoryConfig
  • Loading branch information
vadymmarkov authored May 6, 2018
2 parents a5d5af3 + 308bb89 commit cc82d70
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 9 additions & 4 deletions Source/Shared/Configuration/MemoryConfig.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
1 change: 0 additions & 1 deletion Source/Shared/Storage/MemoryStorage.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}

Expand Down

0 comments on commit cc82d70

Please sign in to comment.