Friday 15 May 2015

redis - What is the return type of HGETALL in Lua -



redis - What is the return type of HGETALL in Lua -

i'm writing lua script , here's script :

local session = redis.call('hgetall', accesstoken) if (session == nil) redis.log(redis.log_warning, 'session not found : ' .. accesstoken) homecoming end

i tried multiple if conditions , cannot find out how validate if value null. also, don't want overhead of calling exists command before.

i tried calling via telnet , response redis *0

here's list tried :

if (session == nil) if (session == '[]') if (session == '{}') if (session == '*0') if (session == '') if (session == '(empty list or set)') if (not session)

none of these conditions working. have idea?

some quick searching online seems suggest result hgetall (and other functions homecoming key/value pairs) table of sequential key/value pairs. {"key1", "val1", "key2", "val2"}.

this indicate empty result (given isn't nil) empty table (i.e. session[1] == nil).

lua redis

No comments:

Post a Comment