Skip to content

Cache expiration issue? #2071

Answered by onevcat
larsparendt asked this question in Q&A
May 1, 2023 · 1 comments · 1 reply
Discussion options

You must be logged in to vote

Is it expected behaviour that expiration for an image is postponed every time it's requested?

Yes. It is intended. Kingfisher goes to a "refresh when read" way when determine a disk cache should be expired or not.

To change this behavior, try .diskCacheAccessExtending, such as:

KF.url(url)
  .diskCacheAccessExtending(.none)
  .set(to: imageView)

// Or this if you prefer the classical way
imageView.kf.setImage(with: url, options: [.diskCacheAccessExtendingExpiration(.none)])

For its reference, check it here if you want to know more.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@larsparendt
Comment options

Answer selected by larsparendt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants