CacheProtocol
public protocol CacheProtocol
缓存调用协议。复杂对象需遵循NSCoding|AnyArchivable协议
-
读取某个缓存
Declaration
Swift
func object(forKey key: String) -> Any?
-
设置某个缓存
Declaration
Swift
func setObject(_ object: Any?, forKey key: String)
-
设置某个缓存,支持缓存有效期,小于等于0为永久有效
Declaration
Swift
func setObject(_ object: Any?, forKey key: String, withExpire expire: TimeInterval)
-
移除某个缓存
Declaration
Swift
func removeObject(forKey key: String)
-
清空所有缓存
Declaration
Swift
func removeAllObjects()