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
var configuration = ImagePipeline.Configuration()
configuration.dataLoader = {
let config = URLSessionConfiguration.default
config.urlCache = nil
return DataLoader(configuration: config)
}()
configuration.dataCache = {
guard let containerURL = FileManager.default.containerURL(forSecurityApplicationGroupIdentifier: AppGroupIdentifier) else {
Log.error("Failed to initialize image pipeline data cache: Could not locate container URL")
return nil
}
let dataCachePath = containerURL.appendingPathComponent(ImageDataCacheName, isDirectory: true)
return try? DataCache(path: dataCachePath)
}()
configuration.dataCachePolicy = .storeAll
STEPS:
Load a remote image with no processors and no thumbnail option (say request A)
Load the same image with thumbnail option (request B)
RESULTS:
Request B freshly downloads the original image again from the network.
EXPECTED:
I thought that since request A caused the cache to save the original image in the disk cache, that request B would be able to just retrieve that original and apply the thumbnail processing. Especially since I've passed .storeAll for the dataCachePolicy and request A has no processors or thumbnail option anyways.
NOTES:
Reading the code, it appears as though perhaps TaskFetchOriginalData should be checking the disk cache for an example of cached original image data before kicking off network activity. Thoughts?
I'm using DataCache and not the URLCache because in my app the images at a URL never change and I wanted to enjoy the performance benefits mentioned in the docs https://kean-docs.github.io/nuke/documentation/nuke/getting-started/. After noticing this issue though, it does occur to me that at least at the moment URLCache would seemingly do a better job of avoiding network activity since in this case the network request would be a cache hit.
Is there maybe something wrong with how I'm setting up the pipeline?
Thank you!
The text was updated successfully, but these errors were encountered:
Hello, I'm setting up my image pipeline like so:
STEPS:
RESULTS:
Request B freshly downloads the original image again from the network.
EXPECTED:
I thought that since request A caused the cache to save the original image in the disk cache, that request B would be able to just retrieve that original and apply the thumbnail processing. Especially since I've passed
.storeAll
for thedataCachePolicy
and request A has no processors or thumbnail option anyways.NOTES:
Reading the code, it appears as though perhaps
TaskFetchOriginalData
should be checking the disk cache for an example of cached original image data before kicking off network activity. Thoughts?I'm using
DataCache
and not theURLCache
because in my app the images at a URL never change and I wanted to enjoy the performance benefits mentioned in the docs https://kean-docs.github.io/nuke/documentation/nuke/getting-started/. After noticing this issue though, it does occur to me that at least at the momentURLCache
would seemingly do a better job of avoiding network activity since in this case the network request would be a cache hit.Is there maybe something wrong with how I'm setting up the pipeline?
Thank you!
The text was updated successfully, but these errors were encountered: