-
Notifications
You must be signed in to change notification settings - Fork 114
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
make GetOrSet and GetAndDelete atomic #107
Conversation
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.
Thanks for the PR (and sorry for the delay on my part). A couple of comments:
@swithek @davseby Hi! Please check the latest version. Please note, that the GetOrSet func has changed. I assume the new logic is better, because when you call GetOrSet you already have a preloaded value, that you pass and you do not want to preload it again internally in the cache |
@DoubleDi will do, later today/tomorrow. |
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.
One comment that needs to be addressed, other than that, everything looks good. @DoubleDi
@swithek when you have time please check |
Thanks for your contribution @DoubleDi. Merging :) |
as it is stated in #97 GetOrSet and GetAndDelete are not atomic.
This PR tries to resolve this problem
I am not sure about the reasons (maybe performance), that the lock was initially made in getWithOpts. Also a good followup question is - do we need the metricsMu at all if this PR will be merged?