TelegramBotApiLibraries/cache/content/common/src/commonMain/kotlin/dev/inmo/tgbotapi/libraries/cache/media/common/MessageContentCache.kt

18 lines
564 B
Kotlin
Raw Normal View History

2022-03-22 12:52:23 +00:00
package dev.inmo.tgbotapi.libraries.cache.media.common
2022-04-11 15:28:53 +00:00
import dev.inmo.tgbotapi.types.message.content.abstracts.MediaContent
2022-03-22 12:52:23 +00:00
import dev.inmo.tgbotapi.types.message.content.abstracts.MessageContent
2022-04-11 15:28:53 +00:00
import io.ktor.utils.io.core.Input
2022-03-22 12:52:23 +00:00
2022-04-11 17:32:06 +00:00
interface MessageContentCache<K> {
suspend fun save(content: MessageContent): K
2022-04-11 15:28:53 +00:00
suspend fun save(
content: MediaContent,
filename: String,
inputAllocator: suspend () -> Input
2022-04-11 17:32:06 +00:00
): K
suspend fun get(k: K): MessageContent?
suspend fun contains(k: K): Boolean
suspend fun remove(k: K)
2022-03-22 12:52:23 +00:00
}