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

Use atomic set #1

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

Use atomic set #1

wants to merge 11 commits into from

Conversation

kozak
Copy link

@kozak kozak commented Jul 12, 2023

No description provided.

@@ -611,7 +611,7 @@ storage_config = {
}
```

Redis >= 2.6.0 is required as this storage requires [PEXPIRE](https://redis.io/commands/pexpire).
Redis >= 2.6.12 is required as this storage requires [SET EX](https://redis.io/commands/set).
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder who uses such antique versions anyway (current is 7.0, 2.6 is not listed in release notes but seems to be from 2015).

Or are there two different versioning schemes?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Haha, https://gist.github.com/lqez/3944436 11 years ago. Maybe it's just 🦖 old.

if err then
return err
elseif ok == 0 then
elseif ok == ngx.null then
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happened here? I can't find ngx.null in the docs

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I used nil at first, but this didn't work. I've noticed that other functions in this module use ngx.null instead.

Copy link
Author

@kozak kozak Jul 12, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

openresty/lua-resty-redis#90

Lua's nil value in an array-like Lua table can make "holes" in the array, which is troublesome for many things, like with the # operator.
When being returned directly as a single value, we need to distinguish a Lua nil value that indicates a low-level error (like network communication failures or timeout) and a valid redis-land null value.
For unit testing, you can swap your lua or luajit command with the resty command (which is provided by OpenResty under <openresty-prefix>/bin/. See

https://github.com/openresty/resty-cli

for the documentation.

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.

2 participants