GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — Supports LRU eviction on disk cache, change the default expire type to accessDate instead of modificationDate by timonus · Pull Request #3759 · SDWebImage/SDWebImage Conversation
|
|
I have done this in my image loading library for quite a long time (though I used to use modification date) https://github.com/timonus/TJImageCache/blob/main/TJImageCache/TJImageCache.m#L196 |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Sounds great. I'll have a check later. Actually these code was not changed at least 5 years...😂 So it's broken at the beginning ? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| } | ||
| NSData *data = [NSData dataWithContentsOfFile:filePath options:self.config.diskCacheReadingOptions error:nil]; | ||
| if (data) { | ||
| [[NSURL fileURLWithPath:filePath] setResourceValue:[NSDate date] forKey:NSURLContentAccessDateKey error:nil]; |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Is this time consuming ?
If so, need a extra if (self.config.diskCacheExpireType == SDImageCacheConfigExpireTypeAccessDate) guard
If not, it's OK
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| _diskCacheWritingOptions = NSDataWritingAtomic; | ||
| _maxDiskAge = kDefaultCacheMaxDiskAge; | ||
| _maxDiskSize = 0; | ||
| _diskCacheExpireType = SDImageCacheConfigExpireTypeModificationDate; |
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
It's ok to change default value, but this PR will marked as Behavior Changes and I'll point this on release changelog
Actually I don't know why the original author use modifyas expire type, since it's not actually LRU (we usually don't write to same cache key image)
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
Can you rebase and run the test cases again (or update the test case with your changes, since you change the default value) The master branch fix the CI issue |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
The OS doesn't automatically bump access time when reading files, so LRU would effectively be equivalent to "least recently downloaded" in SDWebImage.
This is possibly controversial, but I suspect most clients of SDWebImage would prefer files purged based on their last time of use instead of the date when they were downloaded.
|
Alright, rebased and linting seems to pass. It looks like unit tests are all failing to build but I don't think that's caused by the contents of this PR. I updated the one test that referenced modified date here. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@dreampiggy anything I can do to nudge this along? I'm unable to run the tests locally without installing Cocoapods, which I need to make other changes for and I'd rather not do. I don't think the tests are failing due to my change but if they are could you let me know? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
The |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Co-authored-by: DreamPiggy <[email protected]>
Co-authored-by: DreamPiggy <[email protected]>
|
Ah, thank you! Sorry I didn't catch that. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Merge for now. But the release date of 5.20 may be delayed due to other break changes I want to added. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.