Skip to content

Ask the HotKV docs

Answers come only from these docs and can be wrong; check the linked pages before you rely on them.

FCALL_RO

Last updated
FCALL_RO function numkeys [key [key ...]] [arg [arg ...]]
Group
Scripting and functions
Complexity
Depends on the function
Arity
-3 (at least 3 words, counting the command name)
Flags
slow, read-only
HotKV Cloud
All plans
On-Premise
no license needed

FCALL_RO calls a function like FCALL, but only a function registered with the no-writes flag. Because the command is read-only, you can send it to read-only replicas and grant it to users who may not write.

The function’s return value, converted as described for EVAL.

Errors, in addition to those of FCALL:

  • ERR Can not execute a script with write flag using *_ro command. when the function was registered without no-writes.
127.0.0.1:6379> FUNCTION LOAD "#!lua name=readers\nredis.register_function{function_name='peek', callback=function(keys) return redis.call('GET', keys[1]) end, flags={'no-writes'}}"
"readers"
127.0.0.1:6379> SET greeting "hello"
OK
127.0.0.1:6379> FCALL_RO peek 1 greeting
"hello"

Same as Redis 7 and Valkey 8.

FCALL, EVAL_RO, FUNCTION LOAD