DelegatingDataCache

A cache that delegates all operations to DataEntryCaches, who are lazily loaded on register.

Constructors

Link copied to clipboard
constructor(supplier: EntrySupplier)

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard
inline suspend fun <T : Any> DataCache.count(block: QueryBuilder<T>.() -> Unit = {}): Long

Returns the amount of values that match the block.

Link copied to clipboard
inline fun <T : Any> DataCache.find(block: QueryBuilder<T>.() -> Unit = {}): Query<T>

Creates a new Query configured with the block.

Link copied to clipboard
inline fun <T : Any> DataCache.flow(block: QueryBuilder<T>.() -> Unit = {}): Flow<T>

Executes a query with the block and returns the values as a Flow.

Link copied to clipboard
open override fun <T : Any> getEntry(type: KType): DataEntryCache<T>?

Returns a DataEntryCache of the given type if its description was registered beforehand, null otherwise.

Link copied to clipboard
inline fun <T : Any> DataCache.getEntry(): DataEntryCache<T>?

Returns a DataEntryCache of the given T if its description was registered beforehand, null otherwise.

Link copied to clipboard
inline suspend fun <T : Any> DataCache.put(item: T): Unit?
suspend fun <T : Any> DataCache.put(type: KType, item: T): Unit?

Inserts a new item into the cache. Inserting an entry with an id that is already present will cause the old value to be overwritten.

Link copied to clipboard
inline suspend fun <T : Any> DataCache.putAll(vararg items: T): <Error class: unknown class>?
inline suspend fun <T : Any> DataCache.putAll(items: Iterable<T>): <Error class: unknown class>?
inline suspend fun <T : Any> DataCache.putAll(items: Flow<T>): Unit?

Inserts all items into the cache. Inserting an entry with an id that is already present will cause the old value to be overwritten.

Link copied to clipboard
inline fun <T : Any> DataCache.query(block: QueryBuilder<T>.() -> Unit = {}): Query<T>

Creates a new Query configured with the block.

Link copied to clipboard
open suspend fun register(vararg descriptions: DataDescription<out Any, out Any>): <Error class: unknown class>
open suspend fun register(descriptions: Iterable<DataDescription<out Any, out Any>>): <Error class: unknown class>

Registers the descriptions and preforms the necessary setup to use the type of these classes.

open suspend override fun register(description: DataDescription<out Any, out Any>)

Registers a description and preforms the necessary setup to use the type of this class.

Link copied to clipboard
inline suspend fun <T : Any> DataCache.remove(block: QueryBuilder<T>.() -> Unit = {})

Removes all the values that match the block.

Link copied to clipboard

Wraps this cache in a MetricsCache, enabling logging of metrics.