Kotlin, Kotlin Design Patterns, Kotlin Flyweight, Kotlin Flyweight Pattern.
it’ll use Image models, but create them through ImageFactory . data class Image(val bytes: ByteArray) class ImageFactory { private val cache = mutableMapOf<String, Image>() private suspend fun getImage(url: String): Image = cache[url] ?: fetchImage(url).also { image -> cache[url] = image } } As you