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

Add ngx_http_lua_ffi_shdict_store_when for set_when and safe_set_when #1574

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

hnakamur
Copy link
Contributor

@hnakamur hnakamur commented Aug 7, 2019

This pull request adds ngx_http_lua_ffi_shdict_store_when
which is used to define set_when and safe_set_when methods in ngx.shared.DICT.

These methods are useful for avoiding race conditions between successive calls of get and set.
You pass old_value as well as value to set_when, and it changes the value only when the value for the key is still the same as old_value.
Adding this method is suggested in the comment by @doujiang24.

I hereby granted the copyright of the changes in this pull request
to the authors of this lua-nginx-module project.

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.

1 participant