tuweni / org.apache.tuweni.kv / RedisKeyValueStore

RedisKeyValueStore

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

A key-value store backed by Redis.

Parameters

uri - The uri to the Redis store.

keySerializer - the serializer of key objects to bytes

valueSerializer - the serializer of value objects to bytes

keyDeserializer - the deserializer of keys from bytes

valueDeserializer - the deserializer of values from bytes

coroutineContext - the co-routine context in which this store executes

Constructors

<init>

Open a Redis-backed key-value store.

RedisKeyValueStore(port: Int = 6379, address: InetAddress = InetAddress.getLoopbackAddress(), keySerializer: (K) -> Bytes, valueSerializer: (V) -> Bytes, keyDeserializer: (Bytes) -> K, valueDeserializer: (Bytes) -> V)
RedisKeyValueStore(uri: String, keySerializer: (K) -> Bytes, valueSerializer: (V) -> Bytes, keyDeserializer: (Bytes) -> K, valueDeserializer: (Bytes) -> V, coroutineContext: CoroutineContext = Dispatchers.IO)

Properties

coroutineContext

the co-routine context in which this store executes

val coroutineContext: CoroutineContext

Functions

clear

Clears the contents of the store.

suspend fun clear(): Unit

close

Close the store

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

codec

A RedisCodec for working with Bytes classes.

fun codec(): RedisCodec<Bytes, Bytes>

open

Open a Redis-backed key-value store using Bytes keys and values.

fun open(uri: String): RedisKeyValueStore<Bytes, Bytes>

Open a Redis-backed key-value store.

fun <K, V> open(uri: String, keySerializer: Function<K, Bytes>, valueSerializer: Function<V, Bytes>, keyDeserializer: Function<Bytes, K>, valueDeserializer: Function<Bytes, V>): RedisKeyValueStore<K, V>
fun <K, V> open(port: Int, keySerializer: Function<K, Bytes>, valueSerializer: Function<V, Bytes>, keyDeserializer: Function<Bytes, K>, valueDeserializer: Function<Bytes, V>): RedisKeyValueStore<K, V>
fun <K, V> open(address: InetAddress, keySerializer: Function<K, Bytes>, valueSerializer: Function<V, Bytes>, keyDeserializer: Function<Bytes, K>, valueDeserializer: Function<Bytes, V>): RedisKeyValueStore<K, V>
fun <K, V> open(port: Int, address: InetAddress, keySerializer: Function<K, Bytes>, valueSerializer: Function<V, Bytes>, keyDeserializer: Function<Bytes, K>, valueDeserializer: Function<Bytes, V>): RedisKeyValueStore<K, V>