commonMain.net.folivo.trixnity.client.store.RoomOutboxMessageStore.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 kotlinx.coroutines.flow.first
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.RoomOutboxMessageRepository
class RoomOutboxMessageStore(
roomOutboxMessageRepository: RoomOutboxMessageRepository,
tm: RepositoryTransactionManager,
storeScope: CoroutineScope,
config: MatrixClientConfiguration,
) : Store {
private val roomOutboxMessageCache = FullRepositoryObservableCache(
roomOutboxMessageRepository,
tm,
storeScope,
config.cacheExpireDurations.roomOutboxMessage,
) { it.transactionId }
override suspend fun clearCache() = deleteAll()
override suspend fun deleteAll() {
roomOutboxMessageCache.deleteAll()
}
fun getAll(): Flow