EVAL_RO
EVAL_RO script numkeys [key [key ...]] [arg [arg ...]]
- Available since:
- Redis Open Source 7.0.0
- Time complexity:
- Depends on the script that is executed.
- ACL categories:
-
@slow,@scripting, - Compatibility:
- Redis Software and Redis Cloud compatibility
Runs a read-only Lua script. Unlike EVAL, this command can’t run commands that modify data.
For more information about when to use this command versus EVAL, please refer to Read-only scripts.
For more information about EVAL scripts please refer to Introduction to Eval Scripts.
Required arguments
script
The Lua script to evaluate. It must not modify data.
numkeys
The number of key names that follow. Arguments after the keys are passed as regular arguments.
Optional arguments
key [key ...]
The key names the script accesses, provided to it via the Lua KEYS global variable. There must be exactly numkeys of them.
arg [arg ...]
Additional arguments provided to the script via the Lua ARGV variable.
Examples
> SET mykey "Hello"
OK
> EVAL_RO "return redis.call('GET', KEYS[1])" 1 mykey
"Hello"
> EVAL_RO "return redis.call('DEL', KEYS[1])" 1 mykey
(error) ERR Error running script (call to b0d697da25b13e49157b2c214a4033546aba2104): @user_script:1: @user_script: 1: Write commands are not allowed from read-only scripts.
Redis Software and Redis Cloud compatibility
| Redis Software |
Redis Cloud |
Notes |
|---|---|---|
| ✅ Standard |
✅ Standard |
Return information
The return value depends on the script that was executed.