• 周六. 7 月 13th, 2024

5G编程聚合网

5G时代下一个聚合的编程学习网

热门标签

Redis executes Lua script

King Wang

1 月 4, 2022

1、 Client execution
redis-cli –eval myscript.lua key1 key2 , arg1 arg2 arg3
Note that you use commas to separate key And parameters , High energy reminder , Note blank space (key and key、key And commas 、 Commas and arguments 、 There should be spaces between parameters and between them )
./redis-cli –eval [lua Script ] [key…] Space , Space [args…]
2、 Command execution

 
Command format explain Corresponding Jedis client Jedis One of the methods of object ( There are more overload methods )
EVAL script numkeys key [key …] arg [arg …] perform Lua Script

 

public Object eval(String script, int keyCount, String… params)

EVALSHA sha1 numkeys key [key …] arg [arg …] According to the given sha1 Check code , Evaluate scripts cached in the server public Object evalsha(String sha1, int keyCount, String… params)
SCRIPT LOAD script Cache the given script , Don’t execute , And back to sha1 Check value public String scriptLoad(String script)
SCRIPT EXISTS sha1 [sha1 …] Given one or more scripts SHA1 The checksum , Returns a containing 0 and 1 A list of , Indicates whether the script specified by the checksums has been saved in the cache public List<Boolean> scriptExists(String… sha1) 
SCRIPT FLUSH  Clear all Lua Script cache  
SCRIPT KILL Kill the currently running Lua Script , If and only if the script does not perform any write operations , This order will take effect ( If a write operation has been performed , You have to go through shutdown nosave Order to deal with )  

 

发表回复