commonMain.net.folivo.trixnity.client.store.RoomStore.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of trixnity-client-jvm Show documentation
Show all versions of trixnity-client-jvm Show documentation
Multiplatform Kotlin SDK for matrix-protocol
package net.folivo.trixnity.client.store
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.flow.Flow
import net.folivo.trixnity.client.MatrixClientConfiguration
import net.folivo.trixnity.client.store.cache.FullRepositoryObservableCache
import net.folivo.trixnity.client.store.repository.RepositoryTransactionManager
import net.folivo.trixnity.client.store.repository.RoomRepository
import net.folivo.trixnity.core.model.RoomId
class RoomStore(
roomRepository: RoomRepository,
tm: RepositoryTransactionManager,
storeScope: CoroutineScope,
config: MatrixClientConfiguration,
) : Store {
private val roomCache =
FullRepositoryObservableCache(roomRepository, tm, storeScope, config.cacheExpireDurations.room) { it.roomId }
override suspend fun clearCache() = deleteAll()
override suspend fun deleteAll() {
roomCache.deleteAll()
}
fun getAll(): Flow