Skip to content

Commit 81a0598

Browse files
committed
totalCostLimit and countLimit default value
1 parent 099d243 commit 81a0598

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

Sources/SwiftyCache/SwiftyCache.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,10 @@ public final actor SwiftyCache<Key, Value>: Sendable where Key: Hashable & Senda
4848
/// - totalCostLimit: The maximum total cost that the cache can hold before it starts evicting objects.
4949
/// - countLimit: The maximum number of objects the cache should hold.
5050
/// - clearOnMemoryPressure: Whether to clear the cache when memory pressure is detected
51-
public init(totalCostLimit: Int, countLimit: Int, clearOnMemoryPressure: Bool = true) {
51+
public init(totalCostLimit: Int = .max,
52+
countLimit: Int = .max,
53+
clearOnMemoryPressure: Bool = true)
54+
{
5255
self.totalCostLimit = totalCostLimit
5356
self.countLimit = countLimit
5457
self.clearOnMemoryPressure = clearOnMemoryPressure

0 commit comments

Comments
 (0)