CacheUtils

class CacheUtils

Functions

clear
Link copied to clipboard
open fun clear(): Boolean
Clear all of the cache.
getBitmap
Link copied to clipboard
open fun getBitmap(@NonNull() key: String): Bitmap
Return the bitmap in cache.
open fun getBitmap(@NonNull() key: String, defaultValue: Bitmap): Bitmap
Return the bitmap in cache.
getBytes
Link copied to clipboard
open fun getBytes(@NonNull() key: String): Array<Byte>
Return the bytes in cache.
open fun getBytes(@NonNull() key: String, defaultValue: Array<Byte>): Array<Byte>
Return the bytes in cache.
getCacheCount
Link copied to clipboard
open fun getCacheCount(): Int
Return the count of cache.
getCacheSize
Link copied to clipboard
open fun getCacheSize(): Long
Return the size of cache, in bytes.
getDrawable
Link copied to clipboard
open fun getDrawable(@NonNull() key: String): Drawable
Return the drawable in cache.
open fun getDrawable(@NonNull() key: String, defaultValue: Drawable): Drawable
Return the drawable in cache.
getInstance
Link copied to clipboard
open fun getInstance(): CacheUtils
Return the single CacheUtils instance.
open fun getInstance(@NonNull() cacheDir: File): CacheUtils
Return the single CacheUtils instance.
open fun getInstance(cacheName: String): CacheUtils
Return the single CacheUtils instance.
open fun getInstance(maxSize: Long, maxCount: Int): CacheUtils
Return the single CacheUtils instance.
open fun getInstance(@NonNull() cacheDir: File, maxSize: Long, maxCount: Int): CacheUtils
Return the single CacheUtils instance.
open fun getInstance(cacheName: String, maxSize: Long, maxCount: Int): CacheUtils
Return the single CacheUtils instance.
getJSONArray
Link copied to clipboard
open fun getJSONArray(@NonNull() key: String): JSONArray
Return the JSONArray in cache.
open fun getJSONArray(@NonNull() key: String, defaultValue: JSONArray): JSONArray
Return the JSONArray in cache.
getJSONObject
Link copied to clipboard
open fun getJSONObject(@NonNull() key: String): JSONObject
Return the JSONObject in cache.
open fun getJSONObject(@NonNull() key: String, defaultValue: JSONObject): JSONObject
Return the JSONObject in cache.
getParcelable
Link copied to clipboard
open fun <T> getParcelable(@NonNull() key: String, @NonNull() creator: Parcelable.Creator<T>): T
Return the parcelable in cache.
open fun <T> getParcelable(@NonNull() key: String, @NonNull() creator: Parcelable.Creator<T>, defaultValue: T): T
Return the parcelable in cache.
getSerializable
Link copied to clipboard
open fun getSerializable(@NonNull() key: String): Any
Return the serializable in cache.
open fun getSerializable(@NonNull() key: String, defaultValue: Any): Any
Return the serializable in cache.
getString
Link copied to clipboard
open fun getString(@NonNull() key: String): String
Return the string value in cache.
open fun getString(@NonNull() key: String, defaultValue: String): String
Return the string value in cache.
put
Link copied to clipboard
open fun put(@NonNull() key: String, @NonNull() value: Bitmap)
Put bitmap in cache.
open fun put(@NonNull() key: String, @NonNull() value: Drawable)
Put drawable in cache.
open fun put(@NonNull() key: String, @NonNull() value: Parcelable)
Put parcelable in cache.
open fun put(@NonNull() key: String, @NonNull() value: Array<Byte>)
Put bytes in cache.
open fun put(@NonNull() key: String, @NonNull() value: Serializable)
Put serializable in cache.
open fun put(@NonNull() key: String, @NonNull() value: String)
Put string value in cache.
open fun put(@NonNull() key: String, @NonNull() value: JSONArray)
Put JSONArray in cache.
open fun put(@NonNull() key: String, @NonNull() value: JSONObject)
Put JSONObject in cache.
open fun put(@NonNull() key: String, @NonNull() value: Bitmap, saveTime: Int)
Put bitmap in cache.
open fun put(@NonNull() key: String, @NonNull() value: Drawable, saveTime: Int)
Put drawable in cache.
open fun put(@NonNull() key: String, @NonNull() value: Parcelable, saveTime: Int)
Put parcelable in cache.
open fun put(@NonNull() key: String, @NonNull() value: Array<Byte>, saveTime: Int)
Put bytes in cache.
open fun put(@NonNull() key: String, @NonNull() value: Serializable, saveTime: Int)
Put serializable in cache.
open fun put(@NonNull() key: String, @NonNull() value: String, saveTime: Int)
Put string value in cache.
open fun put(@NonNull() key: String, @NonNull() value: JSONArray, saveTime: Int)
Put JSONArray in cache.
open fun put(@NonNull() key: String, @NonNull() value: JSONObject, saveTime: Int)
Put JSONObject in cache.
remove
Link copied to clipboard
open fun remove(@NonNull() key: String): Boolean
Remove the cache by key.

Properties

DAY
Link copied to clipboard
val DAY: Int
HOUR
Link copied to clipboard
val HOUR: Int
MIN
Link copied to clipboard
val MIN: Int
SEC
Link copied to clipboard
val SEC: Int