Don't do prefetch from memory cache if user indeed pass `.fromLoaderOnly`

This commit is contained in:
DreamPiggy 2020-04-05 12:15:22 +08:00
parent d07a405bb5
commit 4613ebfbde
1 changed files with 5 additions and 1 deletions

View File

@ -111,7 +111,11 @@ public final class ImageManager : ObservableObject {
func prefetch() {
isFirstPrefetch = false
var options = self.options
// use `.fromCacheOnly` to query cache only
if options.contains(.fromLoaderOnly) {
// If user indeed ignore cache, don't do prefetch
return
}
// Use `.fromCacheOnly` to query cache only
options.insert(.fromCacheOnly)
var context = self.context ?? [:]
context[.queryCacheType] = SDImageCacheType.memory.rawValue