tuweni / org.apache.tuweni.kv / MapKeyValueStore

MapKeyValueStore

class MapKeyValueStore<K, V> : KeyValueStore<K, V> (source)

A key-value store backed by an in-memory Map.

Parameters

map - The backing map for this store.

Return
A key-value store.

Constructors

<init>

Open an in-memory key-value store.

MapKeyValueStore(map: MutableMap<K, V> = HashMap(), coroutineContext: CoroutineContext = Dispatchers.IO)

Properties

coroutineContext

the kotlin coroutine context

val coroutineContext: CoroutineContext

Functions

clear

Clears the contents of the store.

suspend fun clear(): Unit

close

Has no effect in this KeyValueStore implementation.

fun close(): Unit

containsKey

Returns true if the store contains the key.

suspend fun containsKey(key: K): Boolean

get

Retrieves data from the store.

suspend fun get(key: K): V?

keys

Provides an iterator over the keys of the store.

suspend fun keys(): Iterable<K>

put

Puts data into the store.

suspend fun put(key: K, value: V): Unit

Companion Object Functions

open

Open an in-memory key-value store.

fun <K, V> open(): MapKeyValueStore<K, V>
fun <K, V> open(map: MutableMap<K, V>): MapKeyValueStore<K, V>