DefaultDBConfigLoader

class DefaultDBConfigLoader<T : Any>(type: Class<T>, key: String, cache: Cask<String, T>, db: DBAccessLayer, iDispatcher: SyncDispatcher) : DBConfigLoader<T>

Constructors

Link copied to clipboard
constructor(type: Class<T>, key: String, cache: Cask<String, T>, db: DBAccessLayer, iDispatcher: SyncDispatcher)

Properties

Link copied to clipboard
open override val config: T

The current cached config object for the given key. May throw if no config is loaded or cache expired.

Link copied to clipboard
open override val syncDispatcher: SyncDispatcher

The SyncDispatcher handling background DB sync operations for this loader. Used for shutdown coordination if needed.

Functions

Link copied to clipboard
open override fun reload(): DBConfigLoader<T>

Forces a reload from the database for the current key, replacing the cached object.

Link copied to clipboard
open override fun save(): Boolean

Persists the current cached config object for the current key to the database immediately.

Link copied to clipboard
open override fun update(block: T.() -> Unit)

Applies a mutation to the config object in-place and updates the cache. Does not persist to the database until save or eviction.

Link copied to clipboard
open override fun withKey(key: String): DBConfigLoader<T>

Returns a new loader instance pointing to the given key in the same table.