Kamel-Media / Kamel

Kotlin asynchronous media loading and caching library for Compose.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Persistent cache is not working

Krobys opened this issue · comments

Please tell me how to make the memory cache work. After closing the application and opening it again, pictures are not loaded when the Internet is off.

I have tried all settings, both standard KamelImage and using my own KamelConfig. No matter how hard I tried, the maximum I achieved was that the cache works in short memory, but not in persistent memory.

Ktor version 2.3.9, engines okhttp, darwin
Version kamel 0.9.4

Could you give me a working example of how to make persistent cache work, because those examples I found do not work if you close the application, turn off the internet and open the application again (on any platform, be it ios android).

The memory cache is expected to be empty after restarting an app. Do you mean the disk cache?

Here is how you can configure the disk cache:
https://github.com/Kamel-Media/Kamel?tab=readme-ov-file#disk-cache-size-in-bytes

By default it only persists 10 mib of image data, but you can increase that to how ever large you would like.

I looked into this more. The diskcache is working while online, but ktor throws an error preventing it from loading data from the DataCache when offline on native & jvm targets. Android is working

#104