You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* initial code for downloader
* WIP fetchAndCacheSettings
* fill out request headers
* onComplete
* working fetch
* WIP tests
* working tests
* merge conflicts
* comments
* fix warning in pod-lib-lint
* logger when cache does not expire
* comments
* move os info to ApplicationInfo and fix URL's platform
* if cache does not exist, return empty dictionary instead of nil
* unshadow variable in guard-let statement
* add comment describing task.resume()
* addressing reviews
* attempt fetch every session instead of every app-start
* address last review
Copy file name to clipboardExpand all lines: FirebaseSessions/Sources/SettingsCacheClient.swift
+30-13Lines changed: 30 additions & 13 deletions
Original file line number
Diff line number
Diff line change
@@ -24,42 +24,59 @@ struct CacheKey: Codable {
24
24
25
25
/// SettingsCacheClient is responsible for accessing the cache that Settings are stored in.
26
26
protocolSettingsCacheClient{
27
-
/// Returns in-memory cache content in O(1) time
28
-
varcacheContent:[String:Any]?{get}
27
+
/// Returns in-memory cache content in O(1) time. Returns empty dictionary if it does not exist in cache.
28
+
varcacheContent:[String:Any]{getset}
29
29
/// Returns in-memory cache-key, no performance guarantee because type-casting depends on size of CacheKey
30
-
varcacheKey:CacheKey?{get}
30
+
varcacheKey:CacheKey?{getset}
31
31
/// Removes all cache content and cache-key
32
32
func removeCache()
33
33
}
34
34
35
35
/// SettingsCache uses UserDefaults to store Settings on-disk, but also directly query UserDefaults when accessing Settings values during run-time. This is because UserDefaults encapsulates both in-memory and persisted-on-disk storage, allowing fast synchronous access in-app while hiding away the complexity of managing persistence asynchronously.
0 commit comments