mirror of
https://github.com/InsanusMokrassar/MicroUtils.git
synced 2024-11-19 23:03:49 +00:00
WriteCRUDCacheRepo subscribtions and changeResultsUnchecked(Pagination)
This commit is contained in:
parent
23b2d60295
commit
c9822a491b
@ -2,6 +2,12 @@
|
||||
|
||||
## 0.12.7
|
||||
|
||||
* `Repos`:
|
||||
* `Cache`:
|
||||
* Force `WriteCRUDCacheRepo` to subscribe on new and updated objects of parent repo
|
||||
* `Pagination`:
|
||||
* New function `changeResultsUnchecked(Pagination)`
|
||||
|
||||
## 0.12.6
|
||||
|
||||
* `MimeeTypes>`:
|
||||
|
@ -48,6 +48,14 @@ data class PaginationResult<T>(
|
||||
}
|
||||
|
||||
fun <T> emptyPaginationResult() = PaginationResult<T>(0, 0, emptyList(), 0L)
|
||||
fun <T> emptyPaginationResult(
|
||||
basePagination: Pagination
|
||||
) = PaginationResult<T>(
|
||||
basePagination.page,
|
||||
basePagination.size,
|
||||
emptyList(),
|
||||
0L
|
||||
)
|
||||
|
||||
/**
|
||||
* @return New [PaginationResult] with [data] without checking of data sizes equality
|
||||
|
@ -33,6 +33,14 @@ open class WriteCRUDCacheRepo<ObjectType, IdType, InputValueType>(
|
||||
override val updatedObjectsFlow: Flow<ObjectType> by parentRepo::updatedObjectsFlow
|
||||
override val deletedObjectsIdsFlow: Flow<IdType> by parentRepo::deletedObjectsIdsFlow
|
||||
|
||||
val createdObjectsFlowJob = parentRepo.newObjectsFlow.onEach {
|
||||
kvCache.set(idGetter(it), it)
|
||||
}.launchIn(scope)
|
||||
|
||||
val updatedObjectsFlowJob = parentRepo.updatedObjectsFlow.onEach {
|
||||
kvCache.set(idGetter(it), it)
|
||||
}.launchIn(scope)
|
||||
|
||||
val deletedObjectsFlowJob = parentRepo.deletedObjectsIdsFlow.onEach {
|
||||
kvCache.unset(it)
|
||||
}.launchIn(scope)
|
||||
|
Loading…
Reference in New Issue
Block a user