class SQLKeyValueStore : KeyValueStore
(source)
A key-value store backed by a relational database.
jdbcurl
- The JDBC url to connect to the database.
tableName
- the name of the table to use for storage.
keyColumn
- the key column of the store.
valueColumn
- the value column of the store.
dispatcher
- The co-routine context for blocking tasks.
IOException
- If an I/O error occurs.
Return
A key-value store.
SQLKeyValueStore(jdbcurl: String, tableName: String = "store", keyColumn: String = "key", valueColumn: String = "value", dispatcher: CoroutineDispatcher = Dispatchers.IO)
Open a relational database backed key-value store. |
val keyColumn: String
the key column of the store. |
|
val tableName: String
the name of the table to use for storage. |
|
val valueColumn: String
the value column of the store. |
fun close(): Unit
Closes the underlying connection pool. |
|
suspend fun get(key: Bytes): Bytes?
Retrieves data from the store. |
|
suspend fun put(key: Bytes, value: Bytes): <ERROR CLASS>
Puts data into the store. |
open fun getAsync(key: Bytes): AsyncResult<Bytes?> open fun getAsync(dispatcher: CoroutineDispatcher, key: Bytes): AsyncResult<Bytes?>
Retrieves data from the store. |
|
open fun putAsync(key: Bytes, value: Bytes): AsyncCompletion open fun putAsync(dispatcher: CoroutineDispatcher, key: Bytes, value: Bytes): AsyncCompletion
Puts data into the store. |
fun open(jdbcUrl: String): SQLKeyValueStore fun open(jdbcUrl: String, tableName: String, keyColumn: String, valueColumn: String): SQLKeyValueStore
Open a relational database backed key-value store. |