SqliteMapWriteLayer

class SqliteMapWriteLayer<K, V>(    name: String,     keySerializer: Serializer<K>,     valueSerializer: Serializer<V>) : SqliteManager, MapWriteLayer<K, V>

Implementation of MapWriteLayer that uses sqlite as the storage layer.

Constructors

Link copied to clipboard
fun <K, V> SqliteMapWriteLayer(    name: String,     keySerializer: Serializer<K>,     valueSerializer: Serializer<V>)

Functions

Link copied to clipboard
open suspend override fun clear()

Erase everything.

Link copied to clipboard
open override fun close()
Link copied to clipboard
fun enableWAL()

Util function for enabling WAL mode. Make sure to create the database first by executing some SQL statement before this.

Link copied to clipboard
open suspend override fun get(key: K): V?

Get the value V for the key K if it exists, or return null.

Link copied to clipboard
open suspend override fun getAll(): Map<K, V>

Get all key/value pairs as a map that are currently stored.

Link copied to clipboard
fun query(block: Connection.() -> Unit)

Get a hold of a Connection to execute queries. If you're going to do any write operations then you should use tx instead.

Link copied to clipboard
open suspend override fun remove(key: K)

Remove the key if it exists. Doesn't do anything if the key doesn't exist.

Link copied to clipboard
open suspend override fun reset(to: Map<K, V>)

Wipe out the current state and replace it with to

Link copied to clipboard
open suspend override fun set(key: K, value: V)

Set the value V for key K

Link copied to clipboard
open suspend override fun size(): Int

Get the number of entries.

Link copied to clipboard
fun tx(block: Connection.() -> Unit)

Get a Connection within a transaction. This will just commit for you and rollback in a catch block.

Link copied to clipboard
fun vacuum()

Properties

Link copied to clipboard
open override val databaseUrl: String

JDBC string to pass into DriverManager.getConnection.