Open saket opened 4 days ago
Isn't there already a commitAndOpenSnapshot
?
https://github.com/coil-kt/coil/blob/0582d7587e946c1d19340aee15227bf6aefc7770/coil-core/src/commonMain/kotlin/coil3/disk/RealDiskCache.kt#L66
@revonateB0T That API's only useful if you're also writing the data. Saket's looking for an API that will do URL -> DiskCache.Snapshot. The current way of URL -> disk cache key -> DiskCache.Snapshot allows some cases where disk cache key -> DiskCache.Snapshot will return null (race conditions around simultaneous read/write, cache getting cleared).
Is your feature request related to a problem? Please describe. Telephoto uses coil's disk cache for streaming large images directly from the disk. This is working well for most users, but some users are reporting crashes where coil is returning a null cache entry, possibly because the cache entry was either cleared or opened somewhere else before telephoto could access it.
Describe the solution you'd like
Additional context https://github.com/saket/telephoto/issues/106#issuecomment-2436547617