-
-
Notifications
You must be signed in to change notification settings - Fork 76
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
Set entry's timestamps immediately after insertion #156
Merged
Conversation
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
- `EntryInfo`'s timestamps are no longer optional and set when it is inserted. - Add `is_dirty` flag to the `EntryInfo` to indicate it was just inserted but has not been processed by the housekeeper. - Update the unit tests for `invalidate_all`; remove `cache.sync()` after insertions.
Add `AtomicInstant::new` function `atomic_time_compat` module like we did for`atomic_time` module in a previous commit.
Add `AtomicInstant::new` function `atomic_time_compat` module like we did for`atomic_time` module in a previous commit.
Remove unused statements.
Remove some source code comments.
- Update the change log. - Add doc comments to some of the fields of `EntryInfo`.
- Update internal `evict_lru_entries` and `submit_invalidation_task` methods to check if entry is dirty. - Add some TODO comments about skipping dirty entries to internal `remove_expired_ao` and `remove_expired_wo` methods .
Fix compile errors with `KeyDate<K>::is_dirty` method.
tatsuya6502
commented
Jun 27, 2022
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.
Merging.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Up to Moka v0.8.5, cache entry's
last_modified
andlast_accessed
timestamps were not set to the current time when it was inserted (when it was temporary admitted). Instead, they were set to the time when the entry was admitted. This is done by the housekeeper thread with ~0.3 second interval when cache is not receiving heavy writes.This caused an issue #155 that
invalidate_all
andinvalidate_entries_if
methods will not invalidate entries that were inserted just beforeinvalidate_all
orinvalidate_entries_if
was called.This PR fixes the issue by setting cache entry's
last_modified
andlast_accessed
timestamps to the time when it was inserted:EntryInfo
's timestamps will be set when it is inserted.is_dirty
flag to theEntryInfo
to indicate it was just inserted but has not been processed by the housekeeper.invalidate_all
; removecache.sync()
after insertions.Fixes #155