CacheEngine
open class CacheEngine : NSObject, CacheProtocol, CacheEngineProtocol
缓存引擎基类,自动管理缓存有效期,线程安全。复杂对象需遵循NSCoding|AnyArchivable协议
-
Undocumented
Declaration
Swift
override public init()
-
读取指定key缓存的有效期,大于0有效,小于等于0无效,nil未设置有效期
Declaration
Swift
open func expire(forKey key: String) -> TimeInterval?
-
Declaration
Swift
open func object<T>(forKey key: String) -> T?
-
Declaration
Swift
open func setObject<T>(_ object: T?, forKey key: String)
-
Declaration
Swift
open func setObject<T>(_ object: T?, forKey key: String, withExpire expire: TimeInterval)
-
Declaration
Swift
open func removeObject(forKey key: String)
-
Declaration
Swift
open func removeAllObjects()
-
Declaration
Swift
open func readCache<T>(forKey key: String) -> T?
-
Declaration
Swift
open func writeCache<T>(_ object: T, forKey key: String)
-
Declaration
Swift
open func clearCache(forKey key: String)
-
Declaration
Swift
open func clearAllCaches()