EVALSHA

Since 1.1.0ScriptingKnown issue

Syntax

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

Runs a script the server already has, named by its SHA1 digest, as SCRIPT LOAD returns it, or as a previous EVAL cached it. Clients send the digest instead of the whole script.

Known issue

Refused on a replica with READONLY, even for a script that only reads; use EVALSHA_RO there. Filed as kividb#145, fixed in 1.2.

Reply

  • What the script returns, as for EVAL.
  • NOSCRIPT No matching script. Please use EVAL. if the server does not have it, after a restart or SCRIPT FLUSH, for example.

Examples

> SCRIPT LOAD "return ARGV[1]"
"098e0f0d1448c0a81dafe820f66d460eb09263da"
> EVALSHA 098e0f0d1448c0a81dafe820f66d460eb09263da 0 x
"x"