Skip to content

Commit 75efa1d

Browse files
chore: update default CMAB cache timeout to 30 minutes
1 parent a701d0c commit 75efa1d

File tree

4 files changed

+6
-7
lines changed

4 files changed

+6
-7
lines changed

Sources/CMAB/CmabCache.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@
1616

1717
import Foundation
1818

19+
let DEFAULT_CMAB_CACHE_TIMEOUT = 30 * 60 // 30 minutes
20+
let DEFAULT_CMAB_CACHE_SIZE = 100
21+
1922
class CmabCache: LruCache<String, CmabCacheValue> {
2023
override func lookup(key: String) -> CmabCacheValue? {
2124
if timeoutInSecs <= 0 {

Sources/CMAB/CmabService.swift

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,6 @@ protocol CmabService {
4141
completion: @escaping CmabDecisionCompletionHandler)
4242
}
4343

44-
let DEFAULT_CMAB_CACHE_TIMEOUT = 600 // secs
45-
let DEFAULT_CMAB_CACHE_SIZE = 100
46-
4744
class DefaultCmabService: CmabService {
4845
typealias UserAttributes = [String : Any?]
4946

Sources/ODP/OptimizelySdkSettings.swift

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ public struct OptimizelySdkSettings {
3434
/// VUID is enabled if this is set to true.
3535
let enableVuid: Bool
3636

37-
3837
/// Optimizely SDK Settings
3938
///
4039
/// - Parameters:
@@ -43,7 +42,7 @@ public struct OptimizelySdkSettings {
4342
/// - timeoutForSegmentFetchInSecs: The timeout in seconds of odp segment fetch (optional. default = 10) - OS default timeout will be used if this is set to zero.
4443
/// - timeoutForOdpEventInSecs: The timeout in seconds of odp event dispatch (optional. default = 10) - OS default timeout will be used if this is set to zero.
4544
/// - cmabCacheSize: The maximum size of cmab cache (optional. default = 100).
46-
/// - cmabCacheTimeoutInSecs: The timeout in seconds of amb cache (optional. default = 600).
45+
/// - cmabCacheTimeoutInSecs: The timeout in seconds of amb cache (optional. default = 30 * 60).
4746
/// - disableOdp: Set this flag to true (default = false) to disable ODP features
4847
/// - enableVuid: Set this flag to true (default = false) to enable vuid.
4948
/// - sdkName: Set this flag to override sdkName included in events
@@ -53,7 +52,7 @@ public struct OptimizelySdkSettings {
5352
timeoutForSegmentFetchInSecs: Int = 10,
5453
timeoutForOdpEventInSecs: Int = 10,
5554
cmabCacheSize: Int = 100,
56-
cmabCacheTimeoutInSecs: Int = 600,
55+
cmabCacheTimeoutInSecs: Int = 30 * 60,
5756
disableOdp: Bool = false,
5857
enableVuid: Bool = false,
5958
sdkName: String? = nil,

Tests/OptimizelyTests-APIs/OptimizelyClientTests_ODP.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class OptimizelyClientTests_ODP: XCTestCase {
3939
let optimizely = OptimizelyClient(sdkKey: OTUtils.randomSdkKey)
4040
let cmabCache = ((optimizely.decisionService as! DefaultDecisionService).cmabService as! DefaultCmabService).cmabCache
4141
XCTAssertEqual(100, cmabCache.maxSize)
42-
XCTAssertEqual(600, cmabCache.timeoutInSecs)
42+
XCTAssertEqual(30 * 60, cmabCache.timeoutInSecs)
4343
XCTAssertEqual(100, optimizely.odpManager.segmentManager?.segmentsCache.maxSize)
4444
XCTAssertEqual(600, optimizely.odpManager.segmentManager?.segmentsCache.timeoutInSecs)
4545
XCTAssertEqual(10, optimizely.odpManager.segmentManager?.apiMgr.resourceTimeoutInSecs)

0 commit comments

Comments
 (0)