FCALL_RO to invoke a function that is declared read-only.
The function must have been registered with the no-writes flag; calling a function without it returns an error. In exchange the server knows the call cannot modify data, so it can serve it on replicas and reject accidental writes outright.
Apart from that restriction it behaves like FCALL: <numkeys> splits the arguments into the keys the function receives in KEYS and the plain arguments it receives in ARGV.
Being read-only does not by itself make the call concurrent with others. The function takes the global lock unless it was also registered with the allow-key-locking flag, as in flags={'no-writes', 'allow-key-locking'}. With both flags, the call takes shared read locks on the keys passed in the key list, so several readers of the same key proceed together. See Key-Based Locking.
Syntax
Arguments
Important points
numkeysmust equal the number of key arguments that immediately follow it; remaining arguments are available to the script or function as ordinary arguments.- A
no-writesfunction still takes the global lock unless it was also registered with theallow-key-lockingflag. See Key-Based Locking. - Pass every key the function reads in the key list whether or not
allow-key-lockingis set. A key built inside the function is read from disk under the lock when it is not in memory, and it is rejected outright when the flag is set. See Dynamic Keys and Latency.
Response
The reply reports the result of the operation. Error replies have the same shape in RESP2 and RESP3 and are surfaced as exceptions by the SDKs below.Client libraries often decode bulk strings, maps, sets, and numeric strings into language-native values. The table describes the Redis wire reply.
Examples
TCP examples use the TLSREDIS_URL from the Upstash console. REST examples use UPSTASH_REDIS_REST_URL and UPSTASH_REDIS_REST_TOKEN.
Redis CLI
Redis CLI
@upstash/redis
@upstash/redis
upstash_redis
upstash_redis
This command is not supported yet in
upstash_redis.ioredis
ioredis
node-redis
node-redis
redis-py
redis-py
go-redis
go-redis
jedis
jedis
redis-rs
redis-rs