ICache

interface ICache

缓存接口定义

Author

Jenly

Inheritors

Functions

Link copied to clipboard
abstract fun clear()

清空所有缓存的键值对

Link copied to clipboard
abstract fun getBoolean(key: String, defValue: Boolean): Boolean

根据 key 获取缓存的值,如果未获取到,则返回默认值 defValue

Link copied to clipboard
abstract fun getByteArray(key: String, defValue: ByteArray?): ByteArray?

根据 key 获取缓存的值,如果未获取到,则返回默认值 defValue

Link copied to clipboard
abstract fun getDouble(key: String, defValue: Double): Double

根据 key 获取缓存的值,如果未获取到,则返回默认值 defValue

Link copied to clipboard
abstract fun getFloat(key: String, defValue: Float): Float

根据 key 获取缓存的值,如果未获取到,则返回默认值 defValue

Link copied to clipboard
abstract fun getInt(key: String, defValue: Int): Int

根据 key 获取缓存的值,如果未获取到,则返回默认值 defValue

Link copied to clipboard
abstract fun getLong(key: String, defValue: Long): Long

根据 key 获取缓存的值,如果未获取到,则返回默认值 defValue

Link copied to clipboard
abstract fun <T : Parcelable> getParcelable(key: String, tClass: Class<T>): T?

根据 key 获取缓存的值,如果未获取到,则返回空

abstract fun <T : Parcelable> getParcelable(key: String, tClass: Class<T>, defValue: T?): T?

根据 key 获取缓存的值,如果未获取到,则返回默认值 defValue

Link copied to clipboard
abstract fun getString(key: String, defValue: String?): String?

根据 key 获取缓存的值,如果未获取到,则返回默认值 defValue

Link copied to clipboard
abstract fun getStringSet(key: String, defValue: Set<String>?): Set<String>?

根据 key 获取缓存的值,如果未获取到,则返回默认值 defValue

Link copied to clipboard
abstract fun put(key: String, value: Parcelable?)
abstract fun put(key: String, value: Boolean?)
abstract fun put(key: String, value: ByteArray?)
abstract fun put(key: String, value: Double?)
abstract fun put(key: String, value: Float?)
abstract fun put(key: String, value: Int?)
abstract fun put(key: String, value: Long?)
abstract fun put(key: String, value: String?)
abstract fun put(key: String, value: Set<String>?)

根据 keyvalue 存放到缓存

Link copied to clipboard
abstract fun remove(key: String)

根据 key 删除缓存的键值对