Mopparthy Ravindranath
Mopparthy Ravindranath

Reputation: 3308

Redis RESP3 protocol -- how to set it for luascript?

I am using Redis 7.0.4. I am trying to use RESP3 protocol so that the luascript responses are making more sense. When I use the hello command in luascript, it throws error

This Redis command is not allowed from script

If I set it from command line, it seems to be temporary and fallback to 2.

What is the right way to set it, so my script can take advantage of it?

Upvotes: 0

Views: 222

Answers (1)

for_stack
for_stack

Reputation: 22981

HELLO is not allowed in Lua script. If you want to switch RESP version in Lua script, you should call redis.setresp(version) instead.

-- use RESP3
redis.setresp(3)

Also, RESP3 support some new types, so you need to be careful with the RESP3 data type conversion from/to Lua types. Check this for detail.

Upvotes: 1

Related Questions