EVAL_RO

Since 1.1.0Scripting

Syntax

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

EVAL for a script that only reads: a command in it that writes fails. It can be sent to a read-only replica.

Examples

> EVAL_RO "return redis.call('GET', KEYS[1])" 1 greeting
"hi"
> EVAL_RO "return redis.call('SET', KEYS[1], 1)" 1 greeting
(error) ERR Write commands are not allowed from read-only scripts. script: 492690f94c6c4d47fbb6eb03029dcdfcf5a17028, on @user_script:1.