OkioFileKache

A persistent coroutine-safe ContainerKache implementation that uses Okio to store files.

It uses a journal file to keep track of the cache state and to ensure that the cache is always in a consistent state.

It can be built using the following syntax:

val cache = OkioFileKache(directory = "cache".toPath(), maxSize = 100L * 1024L * 1024L) {
strategy = KacheStrategy.LRU
// ...
}

See also

Types

Link copied to clipboard
object Companion
Link copied to clipboard
class Configuration(var directory: Path, var maxSize: Long)

Configuration for OkioFileKache. It is used as a receiver of OkioFileKache builder which is invoke.

Properties

Link copied to clipboard
open override val maxSize: Long
Link copied to clipboard
open override val size: Long

Functions

Link copied to clipboard
open suspend override fun clear()
Link copied to clipboard
open suspend override fun close()
Link copied to clipboard
open suspend override fun get(key: String): Path?
Link copied to clipboard
open suspend override fun getAllKeys(): KacheKeys<String>
Link copied to clipboard
open suspend override fun getIfAvailable(key: String): Path?
Link copied to clipboard
open suspend override fun getKeys(): Set<String>
Link copied to clipboard
open suspend override fun getOrPut(key: String, creationFunction: suspend (Path) -> Boolean): Path?
Link copied to clipboard
open suspend override fun getUnderCreationKeys(): Set<String>
Link copied to clipboard
open suspend override fun put(key: String, creationFunction: suspend (Path) -> Boolean): Path?
Link copied to clipboard
open suspend override fun putAsync(key: String, creationFunction: suspend (Path) -> Boolean): Deferred<Path?>
Link copied to clipboard
open suspend override fun remove(key: String)
Link copied to clipboard
open suspend override fun removeAllUnderCreation()
Link copied to clipboard
open suspend override fun resize(maxSize: Long)
Link copied to clipboard
open suspend override fun trimToSize(size: Long)