I'm running LUA on Nginx. I decided to fetch some variables via Redis. I am using a table on lua. It is like this;
local ip_blacklist = {
"1.1.1.1",
"1.1.1.2",
}
I'm printing on Nginx;
1.1.1.1
1.1.1.2
I want to keep the values here on Redis and not on Lua. My redis : http://prntscr.com/10sv3ln
My Lua command;
local ip = red:hmget("iplist", "ip_blacklist")
I'm printing on Nginx;
{"1.1.1.1","1.1.1.2",}
Its data does not come as a table and functions do not work. How can I call this data like local ip_blacklist?
https://redis.io/topics/data-types
You cannot store a Lua table as a hash value directly. As I understand, you have stored a literal string
{"1.1.1.1","1.1.1.2",}
using RedisInsight, but it doesn't work that way.You can use JSON for serialization:
Output: