Cache
public enum Cache
Get and set structs to the cache directory
-
Get a struct from the cache
Declaration
Swift
public static func get<T>(key: String, as: T.Type, root: Bool = false) -> T? where T : Decodable, T : EncodableParameters
keyThe name of the item in the cache
asThe struct to use for decoding
rootGet it from the root folder; if false, it will get it from the Host IP folder
Return Value
decoded cache item
-
Save a struct into the cache
Throws
an error if it can’t be savedDeclaration
Swift
public static func set<T>(key: String, object: T, root: Bool = false) throws where T : Decodable, T : EncodableParameters
keyThe name for the item in the cache
objectTthe struct to save
rootStore it in the root folder; if false, it will store it in the Host IP folder
-
Delete a struct from the cache
Throws
an error if it can’t be savedDeclaration
Swift
public static func delete(key: String, root: Bool = false) throwsParameters
keyThe name for the item in the cache
rootDelete it in the root folder; if false, it will delete it from the Host IP folder
View on GitHub
Cache Enumeration Reference