You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I use coil in my app for regular image loading & caching, but I've got a use case in which a user can download certain types of content. These include a media asset and some metadata, among which is a set of images.
Now I use regular Android Downloader for the media asset and store the metadata in a database, but for images I'd like to take advantage of Coil. So I tried to create a custom ImageLoader that will not respect cache headers (so they dont get evicted) and has a diskCache on the filesDir rather than cacheDir.
The problem comes with reading this images; I'd like to use the regular (singleton-declared) imageloader to load this images in my app, so the fact that they come from the downloaded assets is transparent.
I tried sharing the diskcache between both instances of imageLoader but I think the singleton-declared imageLoader will be evicting my images as soon as they're cache TTL is met. Also my disk cache policy on the custom imageloader is to never evict (so max capacity) and I dont want that for regular image loading, and its on the filesDir so it wont be removed when the user manually clears cache, whilst I do want the images loaded with the singleton image loader to be removed when they do that.
Is it possible to declare two separate disk caches? And is it possible to have Coil not evict from the download-diskcache?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I use coil in my app for regular image loading & caching, but I've got a use case in which a user can download certain types of content. These include a media asset and some metadata, among which is a set of images.
Now I use regular Android Downloader for the media asset and store the metadata in a database, but for images I'd like to take advantage of Coil. So I tried to create a custom ImageLoader that will not respect cache headers (so they dont get evicted) and has a diskCache on the filesDir rather than cacheDir.
The problem comes with reading this images; I'd like to use the regular (singleton-declared) imageloader to load this images in my app, so the fact that they come from the downloaded assets is transparent.
I tried sharing the diskcache between both instances of imageLoader but I think the singleton-declared imageLoader will be evicting my images as soon as they're cache TTL is met. Also my disk cache policy on the custom imageloader is to never evict (so max capacity) and I dont want that for regular image loading, and its on the
filesDir
so it wont be removed when the user manually clears cache, whilst I do want the images loaded with the singleton image loader to be removed when they do that.Is it possible to declare two separate disk caches? And is it possible to have Coil not evict from the download-diskcache?
Also, is it possible to manually evict images?
Beta Was this translation helpful? Give feedback.
All reactions