FCALL

Since 1.1.0Scripting

Syntax

FCALL function_name numkeys key [key ...] arg [arg ...]
  • Flags: movablekeys, readonly
  • ACL categories: @scripting, @slow
  • Arity: -3

Calls a function of a library loaded with FUNCTION LOAD. numkeys is how many of the arguments that follow are key names, passed to the function as its first argument; the rest are its second.

A function is held to the flags it was registered with. With no-writes, it cannot write. When the server is at its memory limit, a function runs only if it has allow-oom or no-writes.

On a replica, a function registered with no-writes runs; one without it is refused with READONLY before it runs. Before 1.2, every function was refused there.

In a cluster, a function uses only keys of its own slot, on this node; with the allow-cross-slot-keys flag, keys of any slot this node serves. See Scripting. Before 1.2, a function could write a key of a slot another node owns, and the key was stored on this node.

Reply

  • What the function returns, converted as for EVAL.
  • ERR Function not found.

Examples

> FCALL hello 0 Ada
"hi Ada"