Skip to content

Hw4#4

Open
alexander-gileta wants to merge 2 commits into
mainfrom
hw4
Open

Hw4#4
alexander-gileta wants to merge 2 commits into
mainfrom
hw4

Conversation

@alexander-gileta

Copy link
Copy Markdown
Owner

No description provided.

private val imageCacheService: ImageCacheService,
private val httpClient: OkHttpClient
) {
private val memoryCache = object : LruCache<String, Bitmap>(MEMORY_CACHE_SIZE_KB) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Что-то страшное. Почему бы просто рум не заюзать. Проще фетчить, проще создавать и тп

}

suspend fun loadImage(url: String): Bitmap? = withContext(Dispatchers.IO) {
memoryCache.get(url)?.let { bitmap ->

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Это in memory кэширование. Все же тру кэширование – складывать хотя бы в файлик. Изображения и иконки редко меняются, поэтому их можно складывать в кэш папочку

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants