diff --git a/LaunchDarkly/LaunchDarkly/ServiceObjects/Cache/FeatureFlagCache.swift b/LaunchDarkly/LaunchDarkly/ServiceObjects/Cache/FeatureFlagCache.swift index a916331d..e86fe2e8 100644 --- a/LaunchDarkly/LaunchDarkly/ServiceObjects/Cache/FeatureFlagCache.swift +++ b/LaunchDarkly/LaunchDarkly/ServiceObjects/Cache/FeatureFlagCache.swift @@ -32,7 +32,7 @@ protocol FeatureFlagCaching { /// /// func getCachedData(cacheKey: String, contextHash: String) -> (items: StoredItems?, etag: String?, lastUpdated: Date?) - + /// Retrieve the date the cache for the given key was last updated. See getCachedData for more information. /// /// - parameter cacheKey: The index key into the local cache store. @@ -108,7 +108,7 @@ final class FeatureFlagCache: FeatureFlagCaching { return (items: cachedFlags.flags, etag: etag, lastUpdated: Date(timeIntervalSince1970: TimeInterval(lastUpdated / 1_000))) } - + func getCachedDataLastUpdatedDate(cacheKey: String, contextHash: String) -> Date? { var cachedContexts: [String: Int64] = [:] diff --git a/LaunchDarkly/LaunchDarklyTests/ServiceObjects/Cache/FeatureFlagCacheSpec.swift b/LaunchDarkly/LaunchDarklyTests/ServiceObjects/Cache/FeatureFlagCacheSpec.swift index 55fd769e..4f5d2794 100644 --- a/LaunchDarkly/LaunchDarklyTests/ServiceObjects/Cache/FeatureFlagCacheSpec.swift +++ b/LaunchDarkly/LaunchDarklyTests/ServiceObjects/Cache/FeatureFlagCacheSpec.swift @@ -178,7 +178,7 @@ final class FeatureFlagCacheSpec: XCTestCase { let setMetadata = try JSONDecoder().decode([String: Int64].self, from: mockValueCache.setReceivedArguments!.value) XCTAssertEqual(setMetadata, [hashedContextKey: now.millisSince1970]) } - + func testGetCachedDataLastUpdatedDate() { let now = Date() let flagCache = FeatureFlagCache(serviceFactory: ClientServiceFactory(logger: .disabled), mobileKey: "abc", maxCachedContexts: 5) @@ -187,7 +187,7 @@ final class FeatureFlagCacheSpec: XCTestCase { let lastUpdated = flagCache.getCachedDataLastUpdatedDate(cacheKey: "key", contextHash: "hash") XCTAssertEqual(lastUpdated!.millisSince1970, now.millisSince1970, accuracy: 1_000) } - + func testGetCachedDataLastUpdatedDateKeyDoesntExist() { let now = Date() let flagCache = FeatureFlagCache(serviceFactory: ClientServiceFactory(logger: .disabled), mobileKey: "abc", maxCachedContexts: 5)