Ufuk Köşker
Ufuk Köşker

Reputation: 1480

Why is the image being removed from the cache? | Kingfisher

I am using Kingfisher on SwiftUI. I download the image from url with Kingfisher

I will explain the problem step by step:

  1. I download the image from url
  2. After I close my own application from the background, I open the Instagram application and scroll down continuously on the main page and I make the Instagram application use the cache.
  3. Then I turn off the internet and open my own application.

Problem: When I turn off my internet and open my own application again, I cannot get the pictures from the cache. Why ?

.diskCacheAccessExtending(.expirationTime(.never)) and .diskCacheExpiration(.never) I used these two functions, but the images are still deleted from the cache.

KFImage:

KFImage.url(URL(string: value))
    .resizing(referenceSize: CGSize(width: 50, height: 50), mode: .aspectFit)
    .diskCacheExpiration(.never) // 1
    .diskCacheAccessExtending(.expirationTime(.never)) // 2
                              .loadDiskFileSynchronously()
                              .fade(duration: 1)

Upvotes: 2

Views: 838

Answers (1)

Nadi Hassan
Nadi Hassan

Reputation: 520

In KF the cache is being saved in the Cache directory which is not permanent and might be deleted by the system

Upvotes: 1

Related Questions