DBConfigLoader

interface DBConfigLoader<T : Any>

Main interface for DB-backed configuration loader.

This loader provides access to a cached config object, automatic TTL cache management, and methods for manual reload, save, mutation, and key switching.

Typically, you obtain an instance via DBConfigLoaderBuilder.load.

Parameters

T

the type of the config object being managed

Inheritors

Properties

Link copied to clipboard
abstract 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

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

Functions

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

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

Link copied to clipboard
abstract fun save(): Boolean

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

Link copied to clipboard
abstract 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
abstract fun updateA(block: T.() -> Unit): Boolean

Applies a mutation to the config object and immediately saves it to the database.

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

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