DataEntryCache

interface DataEntryCache<VALUE : Any>

A cache for a single type VALUE.

Types

Link copied to clipboard
object Companion

Functions

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

Returns the amount of values that match the block.

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

Creates a new Query configured with the block.

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

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

Link copied to clipboard
abstract suspend fun put(item: VALUE)

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.

open suspend fun put(vararg items: VALUE): <Error class: unknown class>
open suspend fun put(items: Iterable<VALUE>): <Error class: unknown class>
open suspend fun put(items: Flow<VALUE>)

Inserts the new 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
abstract fun query(): QueryBuilder<VALUE>

Creates a new QueryBuilder that operates on this cache.

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

Creates a new Query configured with the block.

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

Removes all the values that match the block.