Kamel-Media / Kamel

Kotlin asynchronous media loading and caching library for Compose.
Apache License 2.0
636 stars 24 forks source link

Persistent cache is not working #101

Closed Krobys closed 5 months ago

Krobys commented 6 months ago

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).

luca992 commented 6 months ago

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.

luca992 commented 4 months ago

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