CacheMode
public enum CacheMode : Codable, Hashable
A value representing a cache management mode for the Datasync service.
The cache is updated with data got from the Datasync service when the web socket is connected (online). Data in the cache can then be used when the web socket is disconnected (offline).
This value is used when initializing a WebcomApplication
to manage how the cache is initialized and how/when it is saved.
-
Indicates that no cache is used. It is not initialized and cannot be read or saved.
When this value is used:
- No data that may have been read/saved previously is loaded when the
WebcomApplication
instance is initialized. - The
DatasyncService.cache
property returnsnil
. - The
DatasyncService.saveCache()
method is a no-operation.
Declaration
Swift
case no
- No data that may have been read/saved previously is loaded when the
-
Indicates that the cache is initialized and it can be read.
When this value is used:
- Data specified in the associated value, when not
nil
, is loaded when theWebcomApplication
is initialized. - The
DatasyncService.cache
property should be used to get the cache. - The
DatasyncService.saveCache()
method is a no-operation.
Declaration
Swift
case initialized(data: String?)
- Data specified in the associated value, when not
-
Indicates that the cache is initialized and it can be read or save manually.
When this value is used:
- Data possibly saved previously is loaded when the
WebcomApplication
instance is initialized. - The
DatasyncService.cache
property may be used to get the cache (but that shouldn’t be useful). - The
DatasyncService.saveCache()
method should be called to save data.
Declaration
Swift
case manualSaving
- Data possibly saved previously is loaded when the
-
Indicates that the cache is initialized and saved automatically.
When this value is used:
- Data possibly saved previously is loaded when the
WebcomApplication
instance is initialized. - The
DatasyncService.cache
property may be used to get the cache (but that shouldn’t be useful). - Data is saved automatically each time the application is sent to the background.
- Data can also be saved manually using the
DatasyncService.saveCache()
method.
Declaration
Swift
case automatic
- Data possibly saved previously is loaded when the
-
The default cache mode.
This value is used as the default value for the
WebcomConfiguration.cacheMode
property.Declaration
Swift
public static let `default`: CacheMode
-
Declaration
Swift
public init(from decoder: Decoder) throws
-
Declaration
Swift
public func encode(to encoder: Encoder) throws