Cache

interface Cache(source)

This is used to store and retrieve data from cache

Inheritors

Functions

Link copied to clipboard
abstract fun clear()

Clears the cache

abstract fun clear(cacheId: CacheIds)

Clears the cache of a certain cache Id.

Link copied to clipboard
abstract fun contains(key: String): Boolean

Check's if this properties exists in the cache

abstract fun contains(key: String, cacheId: CacheIds): Boolean

Check's if this properties exists in the cache and value exists

Link copied to clipboard
abstract operator fun get(key: String, cacheId: CacheIds): Any?

Gets an item from the cache

Link copied to clipboard
abstract fun getOrPut(key: String, value: Any, cacheId: CacheIds): Any

Gets an item from the cache but adds it if it doesn't exist

Link copied to clipboard
abstract fun remove(key: String, cacheId: CacheIds): Any?

Removes an item from the cache

Link copied to clipboard
abstract operator fun set(key: String, value: Any, cacheId: CacheIds)

Adds a new item to the cache

Link copied to clipboard
abstract fun triggerCacheClear(duration: Duration, repeat: Boolean = true)

Triggers a thread to clear the entire cache after a certain amount of time

Link copied to clipboard
abstract fun triggerCacheTypeClear(cacheId: CacheIds, duration: Duration, repeat: Boolean = true)

Triggers a thread to clear a certain cache type after a certain amount of time

Link copied to clipboard
abstract fun triggerCacheTypesClear(cacheIds: List<CacheIds>, duration: Duration, repeat: Boolean = true)

Triggers a thread to clear a list of cache types after a certain amount of time

Link copied to clipboard
abstract fun values(cacheId: CacheIds): List<Any>

Gets a list of objects in the cache

Properties

Link copied to clipboard
abstract val size: Int

The size of the cache