-
Notifications
You must be signed in to change notification settings - Fork 361
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 ability to set an object level TTL #209
Merged
garrettmoon
merged 39 commits into
pinterest:master
from
mjlazar:object-level-ttl-override
May 11, 2018
Merged
Changes from 30 commits
Commits
Show all changes
39 commits
Select commit
Hold shift + click to select a range
a08b66c
Add new `ageLimit` setters in PINCaching protocol
mjlazar 3d7714e
Implement `ageLimit` methods in PINDiskCache
mjlazar d1c796a
Implement `ageLimit` methods in PINMemoryCache
mjlazar f7d6d3c
Implement `ageLimit` methods in PINCache
mjlazar 336d401
Honor `ageLimit` (at both cache and object level) in -[PINDiskCache c…
mjlazar 6be8d22
Honor `ageLimit` (at both cache and object level) in -[PINDiskCache c…
mjlazar c2dfcd6
Merge branch 'object-level-ttl-override' of github.com:mjlazar/PINCac…
mjlazar 4b05c88
Update CHANGELOG
mjlazar 0d4e71d
Add new NSDate category for swizzling +[NSDate date] in unit tests
mjlazar d4d7640
Change memory and disk caches to use +[NDate date] instead of -[NSDat…
mjlazar b4b7ac2
Add unit tests for object-level TTLs
mjlazar 171de47
Update header documentation regarding object-level age limits
mjlazar 723c326
Clear previously set object age limits if setting to zero
mjlazar 06e331c
Add assertions to ttlCache is set to YES if object-level age limits a…
mjlazar 3895432
Update header documentation to describe behavior of overridden object…
mjlazar a4466b6
Remove `hasAgeLimit` logic
mjlazar c762a84
Misc cleanup
mjlazar fd103ca
Handle failure on extended attribute read
mjlazar fb7694b
Make sure trim methods do not remove objects with overridden age limits
mjlazar e504b0b
New methods to remove expired objects from cache
mjlazar 24ea58a
Remove expired objects from disk cache on initialization if any objec…
mjlazar f539d78
Remove expired objects from memory cache on memory warning
mjlazar a27d755
Fix expiration logic
mjlazar 4b383a5
Add unit test for removeExpiredObjects
mjlazar 662a7cb
Remove assert in -setObject:...
mjlazar 7fa42e3
Call async version of -removeExpiredObjects in -initializeDiskProperties
mjlazar 9c3b33b
Tweaks
mjlazar 7d88344
Merge branch 'master' into object-level-ttl-override
garrettmoon 92e1d59
Fix warnings
mjlazar 71b7fb9
Make ttlCache a readonly property
mjlazar 2d0ae4b
Changes to address feedback from @garrettmoon
mjlazar 6a34a58
Merge branch 'master' into object-level-ttl-override
mjlazar a47eff1
Merge branch 'master' into object-level-ttl-override
garrettmoon b5a6640
Changes to address @garrettmoon's feedback
mjlazar fab908f
Fix indents.
mjlazar f7216ed
Merge branch 'master' into object-level-ttl-override
mjlazar 60c83aa
Adding additional tests
mjlazar 2655498
Fix race condition in unit tests
mjlazar 871f503
Update CHANGELOG
mjlazar File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Once this lands, I wonder if we could reduce the complexity of everything by changing this line to:
[self setObjectAsync:object forKey:key withCost:cost ageLimit:self.isTTLCache ? self.ageLimit : 0.0 completion:block]
Then we could get rid of any other logic that deals with isTTLCache?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that could certainly be done, but it would have to be in conjunction with some changes to the trim-to-date methods. Since this would essentially set object-level age limits all of the time, we could combine the current trimming logic with the new -removeExpiredObjects logic I'm proposing in this PR.