ids in crud repos

This commit is contained in:
2022-12-02 13:46:06 +06:00
parent 04c301d1ac
commit 217e977f0d
14 changed files with 88 additions and 0 deletions

View File

@@ -46,6 +46,12 @@ open class FullReadCRUDCacheRepo<ObjectType, IdType>(
{ if (it.results.isNotEmpty()) actualizeAll() }
)
override suspend fun getIdsByPagination(pagination: Pagination): PaginationResult<IdType> = doOrTakeAndActualize(
{ keys(pagination).takeIf { it.results.isNotEmpty() }.optionalOrAbsentIfNull },
{ getIdsByPagination(pagination) },
{ if (it.results.isNotEmpty()) actualizeAll() }
)
override suspend fun count(): Long = doOrTakeAndActualize(
{ count().takeIf { it != 0L }.optionalOrAbsentIfNull },
{ count() },