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

red:smembers("key"), sometime not include the new member? #13326

Closed
1 task done
yuchao-java opened this issue Jul 3, 2024 · 3 comments
Closed
1 task done

red:smembers("key"), sometime not include the new member? #13326

yuchao-java opened this issue Jul 3, 2024 · 3 comments

Comments

@yuchao-java
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Kong version ($ kong version)

Kong 3.4.0

Current Behavior

in my kong lua scripts, I write some code in access function like this:
local redis = require "resty.redis"
local red = redis:new()
red:set_timeouts(5000, 5000, 5000)
local ok, err = red:connect(redisHost, redisPort)
local result, err = red:smembers("all_allow_urls")
local ok, keep_err = red:set_keepalive(10000, 100)
at first, the key "all_allow_urls" in redis is a set, which include 10 members, then I execute SADD all_allow_urls 'aaa' in redis-cli cmd;
but when I visit my kong to check the result from red:smembers("all_allow_urls"), it sometimes include "aaa" but sometimes not。
what's wrong?

Expected Behavior

when some data changed in redis, I can use resty.redis to acquire the new data always

Steps To Reproduce

I execute set key1 value1 in redis-cli cmd,
In my lua script:
local result, err =red:get("key1"), the result is userdata: NULL when the red.get_reused_times() > 1, and the result is aaa when the red.get_reused_times() == 0.
How to get new data everytime in redis when the data is changed?

Anything else?

No response

@chronolaw
Copy link
Contributor

I think that it is not a kong gateway related issue, could we turn to lua-resty-redis library?

@yuchao-java
Copy link
Author

I just using lua-resty-redis library like this:
local redis = require "resty.redis"

@hanshuebner
Copy link
Contributor

Superseded by openresty/lua-resty-redis#277

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

No branches or pull requests

3 participants