Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add SDWebImageWaitStoreCache, which wait for all the async disk cache written finished and then callback, useful for advanced user who want to touch the cache right in completion block #2900

Merged
merged 1 commit into from
Dec 2, 2019

Conversation

dreampiggy
Copy link
Contributor

New Pull Request Checklist

  • I have read and understood the CONTRIBUTING guide

  • I have read the Documentation

  • I have searched for a similar pull request in the project and found none

  • I have updated this branch with the latest master to avoid conflicts (via merge from master or rebase)

  • I have added the required tests to prove the fix/feature I am adding

  • I have updated the documentation (if necessary)

  • I have run the tests and they pass

  • I have run the lint and it passes (pod lib lint)

This merge request fixes / refers to the following issues: ...

Pull Request Description

Background

Sometime, user may want to touch the disk cache right in the manager/UIImageView category completion block. However, the current code does not gurantee the callback is after the cache written. You may get the wrong logic if you assume disk cache is ready.

This PR introduce a option SDWebImageWaitStoreCache to ensure we callback completion block, Only after we already written everything finished, solve this problem and use case.

See the same use case and issue in Kingfisher.

…he written finished and then callback, useful for advanced user who want to touch the cache right in completion block
@codecov
Copy link

codecov bot commented Nov 29, 2019

Codecov Report

Merging #2900 into master will increase coverage by 0.11%.
The diff coverage is 91.48%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2900      +/-   ##
==========================================
+ Coverage   83.78%   83.89%   +0.11%     
==========================================
  Files          67       67              
  Lines        6591     6626      +35     
==========================================
+ Hits         5522     5559      +37     
+ Misses       1069     1067       -2
Flag Coverage Δ
#ios 84.7% <91.48%> (+0.05%) ⬆️
#macos 82.78% <91.48%> (+0.25%) ⬆️
#tvos 84.74% <91.48%> (+0.17%) ⬆️
Impacted Files Coverage Δ
SDWebImage/Core/SDWebImageManager.m 90.78% <91.48%> (+1.19%) ⬆️
SDWebImage/Core/SDWebImageDownloaderOperation.m 92.7% <0%> (+0.3%) ⬆️
SDWebImage/Core/SDAnimatedImageView.m 81.65% <0%> (+0.45%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6d7a68e...e37d07b. Read the comment docs.

Copy link
Member

@kinarobin kinarobin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding a test case is better! 😊

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants