kean/Nuke

Images fetched with ImagePrefetcher on shared pipeline are not in cache, but they are when manually loading each one

adamvnovak opened this issue · 1 comments

Even when I use the Nuke prefetcher method as below, the images are not found in the cache.

Config (.diskCache or .memoryCache doesnt make a difference for me)
let prefetcher = ImagePrefetcher(pipeline: .shared, destination: .diskCache, maxConcurrentRequestCount: 50)
In UITableViewPrefetcherDelegate's method
prefetcher.startPrefetching(with: photoImageRequestsForIndexPaths(indexPaths))
Then, image is nil here:
ImagePipeline.shared.cache.cachedImage(for: PhotoView.imageRequest(for: url))?.image

--

However, loading each image individually on the pipeline IS working:

photoImageRequestsForIndexPaths(indexPaths).forEach { imageRequest in
    ImagePipeline.shared.loadImage(with: imageRequest, progress: nil) { result in
        
    }
}

Then, image EXISTS here:
ImagePipeline.shared.cache.cachedImage(for: PhotoView.imageRequest(for: url))?.image

--

This is the configuration of my shared pipeline:
ImagePipeline.shared = ImagePipeline(configuration: .withDataCache(name: "dataCache", sizeLimit: 1024 * 1024 * 1024))
What could be wrong here?

kean commented

Hey, I would appreciate if you could provide a small sample where it could;d be reproduced.

I would start debugging it by making sure prefetcher.startPrefetching gets called.