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

Support unlimited disk cache time #566

Merged
merged 6 commits into from
Jan 20, 2017
Merged

Support unlimited disk cache time #566

merged 6 commits into from
Jan 20, 2017

Conversation

onevcat
Copy link
Owner

@onevcat onevcat commented Jan 19, 2017

For #559

@codecov-io
Copy link

codecov-io commented Jan 20, 2017

Current coverage is 73.63% (diff: 100%)

Merging #566 into master will decrease coverage by 0.19%

@@             master       #566   diff @@
==========================================
  Files            21         21          
  Lines          2240       2242     +2   
  Methods           0          0          
  Messages          0          0          
  Branches          0          0          
==========================================
- Hits           1654       1651     -3   
- Misses          586        591     +5   
  Partials          0          0          

Powered by Codecov. Last update 077fc0a...e459e89

@onevcat onevcat merged commit 29db810 into master Jan 20, 2017
@onevcat onevcat deleted the fix/forever-disk-cache branch January 20, 2017 04:34
@@ -93,6 +93,7 @@ open class ImageCache {

/// The longest time duration in second of the cache being stored in disk.
/// Default is 1 week (60 * 60 * 24 * 7 seconds).
/// Setting this to a negative value will make the disk cache never expiring.
Copy link
Contributor

Choose a reason for hiding this comment

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

setting this to 0 should have the same effect as negative

Copy link
Owner Author

Choose a reason for hiding this comment

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

It's intended to have only negative number for "forever". 0 means expiring immediately. And since there is a default non-zero value here, it is better to opt out 0 so we could avoid to introduce misunderstanding.

@@ -475,7 +476,7 @@ open class ImageCache {

let diskCacheURL = URL(fileURLWithPath: diskCachePath)
let resourceKeys: Set<URLResourceKey> = [.isDirectoryKey, .contentAccessDateKey, .totalFileAllocatedSizeKey]
let expiredDate = Date(timeIntervalSinceNow: -maxCachePeriodInSecond)
let expiredDate = (maxCachePeriodInSecond < 0) ? nil : Date(timeIntervalSinceNow: -maxCachePeriodInSecond)
Copy link
Contributor

Choose a reason for hiding this comment

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

<= 0

rain2540 pushed a commit to rain2540/Kingfisher that referenced this pull request Feb 28, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants