Latest web development tutorials

Redis Evalsha command

Redis script

Redis Evalsha order under the given sha1 checksum, execute scripts in the server cache.

grammar

redis Evalsha basic command syntax is as follows:

redis 127.0.0.1:6379> EVALSHA sha1 numkeys key [key ...] arg [arg ...] 

Parameter Description:

  • script: Parameter is a piece of Lua 5.1 script.Script does not (and should not) be defined as a Lua function.
  • numkeys: for the number of parameters specified key.
  • key [key ...]: From the third argument EVAL start date, showing in the script used by the those Redis key (key), the key name parameters can be global variables KEYS array in Lua, with 1 in the form of base address access (KEYS [1], KEYS [2], and so on).
  • arg [arg ...]: additional parameters in Lua through the global variable ARGV array access, forms and variable access KEYS similar (ARGV [1], ARGV [ 2], and so on).

Available versions

> = 2.6.0

Examples

redis 127.0.0.1:6379> SCRIPT LOAD "return 'hello moto'"
"232fd51614574cf0867b83d384a5e898cfd24e5a"

redis 127.0.0.1:6379> EVALSHA "232fd51614574cf0867b83d384a5e898cfd24e5a" 0
"hello moto"

Redis script