Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Coil Image Loader : Cache Bitmap with a key

I am using Coil Image loading library.

My Problem:

I am not getting image Url from backend, rather I am getting JPEG encoded String with its name / key.

What I was wondering is if there is any inbuilt support for caching bitmap with respect to a key so that I can avoid asking for that encoded string every time I want to show that Image.

Is it possible? If not what might be the best way to solve my issue?

Thanks in advance.

like image 847
erluxman Avatar asked Jan 22 '26 21:01

erluxman


1 Answers

Coil relies on OkHttp's disk cache which controls its own cache key which is based off the URL. However it's possible to set the memory cache key using RequestBuilder.key.

If you need to set the cache key for the data after it's been fetched, I don't think there's an inbuilt solution for that at the moment unfortunately.

like image 180
Colin White Avatar answered Jan 25 '26 11:01

Colin White



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!