Storage

interface Storage<T : Any>

Storage for a set of objects keyed by String

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard
fun <T : Any> Storage<T>.debug(printFn: (String) -> Unit = ::println): Storage<T>

Debug all inputs and outputs of storage calls.

Link copied to clipboard
abstract operator fun get(key: String): T?

Get a value from the storage by key

Link copied to clipboard
operator fun <V : Any> Storage<V>.get(key: Value<*>): V?
Link copied to clipboard
fun <T : Any> Storage<T>.getOrPut(key: Value<*>, fn: () -> T): T
Link copied to clipboard
abstract fun keySet(keyPrefix: String = ""): Set<String>

Get all of the keys avaulable in the storage

Link copied to clipboard
open operator fun minusAssign(key: String)

Remove the object from the storage by key

Link copied to clipboard
operator fun <T : Any> Storage<T>.minusAssign(key: Value<*>)
Link copied to clipboard
abstract fun remove(key: String): Boolean

Remove the object from the storage by key

Link copied to clipboard
fun <V : Any> Storage<V>.remove(key: Value<*>): Boolean
Link copied to clipboard
abstract fun removeAll(keyPrefix: String = ""): Boolean

Remove all objects from the storage which match the keyPrefix

Link copied to clipboard
abstract operator fun set(key: String, data: T)

Set a value in the storage against a key

Link copied to clipboard
operator fun <V : Any> Storage<V>.set(key: Value<*>, v: V)