Replies: 1 comment 2 replies
-
The main reason Coil uses its own disk cache in 2.0 is because Coil uses thread interruption while decoding to cancel much faster. Part of reason Picasso and Coil 1.x are able to use OkHttp's disk cache is because they don't use thread interruption (which is slower). Additionally, OkHttp's cache doesn't provide direct file access which is sometimes needed. If you use OkHttp's Overall, I'd recommend only using Coil's custom |
Beta Was this translation helpful? Give feedback.
-
We're migrating from Picasso to Coil for an app with a chat-like screen. We need to show images on the screen as well as download files (including images) for passing them to other apps, minimizing network and storage usage.
Files are downloaded through OkHttp, with disk cache configured.
For Picasso we've enabled integration with the same OkHttp instance (
OkHttp3Downloader(okHttpClient)
), which results in downloading and storing images only once for all these tasks.AFAIK, the same was possible with Coil 1.x, but not with Coil 2. The docs specifically says: "You should not use OkHttp's
Cache
with Coil 2.0 as the cache can be corrupted if a thread is interrupted while writing to it"That sounds scary. Should we opt for Coil 1.4 or does that issue affect 1.x too? Are there any better ways to achieve our goals?
Beta Was this translation helpful? Give feedback.
All reactions