FCALL_RO

Invokes a registered function through the read-only path.

Lua & functions · Example verified

Syntax covered here

FCALL_RO function numkeys key

Load the library first; the verified function declares no-writes and uses GET on its supplied key.

Tested example & replies

Requests below run in order against an empty database. Each connection authenticates with the fixture password first. Quoted values are strings; null is a nil reply; arrays preserve RESP order.

# connection: default
> FUNCTION FLUSH
"OK"
# connection: default
> FUNCTION LOAD "#!lua name=manual\nredis.register_function{function_name='read_value', callback=function(keys,args) return redis.call('GET',keys[1]) end, flags={'no-writes'}}"
"manual"
# connection: default
> SET sample value
"OK"
# connection: default
> fcall_ro read_value 1 sample
"value"