-
-
Notifications
You must be signed in to change notification settings - Fork 532
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Incorrect original image cache key when using thumbnail options #705
Comments
Thanks for the report. I'm going to try to reproduce it using unit tests. If you could provide a sample code to reproduce it, it would also be appreciated. |
Hey @hyouuu, can you please check if you are using the same URLs in both of these scenarios? |
@kean yes I checked multiple times that the urls are exactly the same. And sorry got really occupied to provide a sample project right now |
Sorry @kean just realized that I missed an important detail - I'm using the thumbnail option which might well be the root of the issues:
Where thumbnailMinSideThreshold = 200 |
That's perfect, thanks. That's precisely what the root cause is. Steps
Expected Result The pipeline stores original image data in disk cache using "https://example.com/image.jpeg" as the disk cache key Observed Result The pipeline stores original image data in disk cache using "https://example.com/image.jpeg+com.github/kean/nuke/thumbnail?width=400.0,height=400.0" as the disk cache key |
So, if you would like to remove the cached image manually, make sure to pass the exact thumbnail options in the request. |
@kean I tried without the thumbnail option but the cache is still returning wrong images - please look into if there are any other possible causes |
The thumbnail issues were fixed in Nuke 12.6. If the issues persistent, please, provide a small sample project or, ideally, a unit test with reproduction steps. |
Hello! We're using 11.3.1 (because our StreamChat depends on that version) and we're using the cache like this:
// setup
ImagePipeline.shared = ImagePipeline(configuration: .withDataCache)
// setting the cache to the corresponding url right after taking a photo
ImagePipeline.shared.cache.storeCachedData(imageData, for: ImageRequest(url: URL(string: remoteURL)!))
// Try to use cached data - sometimes this gives cache and if accessed later on sometimes not anymore
if let cached = ImagePipeline.shared.cache.cachedImage(for: ImageRequest(url: url)) {
// Here the cached image will be wrong - would be a previously cached image data of a different url
}
It seems the cache behavior is not deterministic and giving wrong data is pretty concerning - it feels there's some self correction actions to invalidate the cache somehow after accessing it - any insights?
Not sure if this is related to #700
The text was updated successfully, but these errors were encountered: