1. Redis脚本?
Redis脚本使用Lua解释器来执行脚本。Redis2.6版本通过内嵌支持Lua环境。执行脚本的常用命令为EVAL
。
EVAL基本语法
EVAL script numkeys key [key...] arg [arg...]
2. 实例
3. 常见的脚本操作指令
命令 | 解释 |
---|---|
EVAL script numkeys key [key...] arg [arg...] | 执行Lua脚本 |
EVALSHA sha1 numkeys key [key...] arg [arg...] | 执行Lua脚本 |
SCRIPT EXISTS script [script...] | 查看指定的脚本是否被保存在缓存当中 |
SCRIPT FLUSH | 从脚本缓存中移除所有脚本 |
SCRIPT KILL | 杀死当前正在运行的Lua脚本 |
SCRIPT LOAD script | 将脚本script添加到脚本缓存中,但不立即执行这个脚本 |