AutoRecacheCRUDRepo

open class AutoRecacheCRUDRepo<RegisteredObject, Id, InputObject>(originalRepo: CRUDRepo<RegisteredObject, Id, InputObject>, scope: CoroutineScope, kvCache: KeyValueRepo<Id, RegisteredObject> = MapKeyValueRepo(), recacheDelay: Long = 60.seconds.inWholeMilliseconds, actionWrapper: ActionWrapper = ActionWrapper.Direct, idGetter: (RegisteredObject) -> Id) : AutoRecacheReadCRUDRepo<RegisteredObject, Id> , WriteCRUDRepo<RegisteredObject, Id, InputObject> , CRUDRepo<RegisteredObject, Id, InputObject> (source)

Constructors

Link copied to clipboard
constructor(originalRepo: CRUDRepo<RegisteredObject, Id, InputObject>, scope: CoroutineScope, originalCallTimeoutMillis: Long, kvCache: KeyValueRepo<Id, RegisteredObject> = MapKeyValueRepo(), recacheDelay: Long = 60.seconds.inWholeMilliseconds, idGetter: (RegisteredObject) -> Id)
constructor(originalRepo: CRUDRepo<RegisteredObject, Id, InputObject>, scope: CoroutineScope, kvCache: KeyValueRepo<Id, RegisteredObject> = MapKeyValueRepo(), recacheDelay: Long = 60.seconds.inWholeMilliseconds, actionWrapper: ActionWrapper = ActionWrapper.Direct, idGetter: (RegisteredObject) -> Id)

Properties

Link copied to clipboard
val autoUpdateJob: Job
Link copied to clipboard
open override val deletedObjectsIdsFlow: Flow<Id>
Link copied to clipboard
open override val newObjectsFlow: Flow<RegisteredObject>
Link copied to clipboard

Just mirroring WriteCRUDRepo.deletedObjectsIdsFlow to be same as in KV repos

Link copied to clipboard

Just mirroring WriteCRUDRepo.newObjectsFlow to be same as in KV repos

Link copied to clipboard

Just mirroring WriteCRUDRepo.updatedObjectsFlow to be same as in KV repos

Link copied to clipboard
open override val updatedObjectsFlow: Flow<RegisteredObject>

Functions

Link copied to clipboard
Link copied to clipboard
fun <ObjectType, IdType, InputType> WriteCRUDRepo<ObjectType, IdType, InputType>.caching(kvCache: KVCache<IdType, ObjectType>, scope: CoroutineScope, locker: SmartRWLocker = SmartRWLocker(), idGetter: (ObjectType) -> IdType): WriteCRUDCacheRepo<ObjectType, IdType, InputType>
Link copied to clipboard
open suspend override fun contains(id: Id): Boolean
Link copied to clipboard
open suspend override fun count(): Long
Link copied to clipboard
open suspend override fun create(values: List<InputObject>): List<RegisteredObject>
Link copied to clipboard
open suspend override fun deleteById(ids: List<Id>)
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
fun <ObjectType, IdType, InputType> CRUDRepo<ObjectType, IdType, InputType>.fullyCached(kvCache: KeyValueRepo<IdType, ObjectType> = MapKeyValueRepo(), scope: CoroutineScope = CoroutineScope(Dispatchers.Default), skipStartInvalidate: Boolean = false, locker: SmartRWLocker = SmartRWLocker(), idGetter: (ObjectType) -> IdType): FullCRUDCacheRepo<ObjectType, IdType, InputType>
Link copied to clipboard
open suspend override fun getAll(): Map<Id, RegisteredObject>
Link copied to clipboard
open suspend override fun getById(id: Id): RegisteredObject?
Link copied to clipboard
open suspend override fun getByPagination(pagination: Pagination): PaginationResult<RegisteredObject>
Link copied to clipboard
open suspend override fun getIdsByPagination(pagination: Pagination): PaginationResult<Id>
Link copied to clipboard
open suspend override fun invalidate()

Invalidates its internal data. It may lead to autoreload of data. In case when repo makes autoreload, it must do loading of data before clear

Link copied to clipboard
inline suspend fun ReadCRUDRepo<*, *>.maxPagePagination(): SimplePagination
Link copied to clipboard
open suspend override fun update(values: List<UpdatedValuePair<Id, InputObject>>): List<RegisteredObject>
open suspend override fun update(id: Id, value: InputObject): RegisteredObject?
Link copied to clipboard
inline fun <FromKey, FromValue, ToKey, ToValue> ReadCRUDRepo<ToValue, ToKey>.withMapper(noinline keyFromToTo: suspend FromKey.() -> ToKey = { this as ToKey }, noinline valueFromToTo: suspend FromValue.() -> ToValue = { this as ToValue }, noinline keyToToFrom: suspend ToKey.() -> FromKey = { this as FromKey }, noinline valueToToFrom: suspend ToValue.() -> FromValue = { this as FromValue }): ReadCRUDRepo<FromValue, FromKey>
inline fun <FromKey, FromValue, FromInput, ToKey, ToValue, ToInput> CRUDRepo<ToValue, ToKey, ToInput>.withMapper(noinline keyFromToTo: suspend FromKey.() -> ToKey = { this as ToKey }, noinline valueFromToTo: suspend FromValue.() -> ToValue = { this as ToValue }, noinline inputFromToTo: suspend FromInput.() -> ToInput = { this as ToInput }, noinline keyToToFrom: suspend ToKey.() -> FromKey = { this as FromKey }, noinline valueToToFrom: suspend ToValue.() -> FromValue = { this as FromValue }, noinline inputToToFrom: suspend ToInput.() -> FromInput = { this as FromInput }): CRUDRepo<FromValue, FromKey, FromInput>
inline fun <FromKey, FromValue, FromInput, ToKey, ToValue, ToInput> WriteCRUDRepo<ToValue, ToKey, ToInput>.withMapper(noinline keyFromToTo: suspend FromKey.() -> ToKey = { this as ToKey }, noinline valueFromToTo: suspend FromValue.() -> ToValue = { this as ToValue }, noinline inputFromToTo: suspend FromInput.() -> ToInput = { this as ToInput }, noinline keyToToFrom: suspend ToKey.() -> FromKey = { this as FromKey }, noinline valueToToFrom: suspend ToValue.() -> FromValue = { this as FromValue }, noinline inputToToFrom: suspend ToInput.() -> FromInput = { this as FromInput }): WriteCRUDRepo<FromValue, FromKey, FromInput>