官方文档: https://redis.io/docs/latest/develop/programmability/lua-api
<font style="color:rgb(96, 98, 102);background-color:rgb(245, 247, 250);">EVAL script numkeys key [key ...] arg [arg ...]</font>
script:lua脚本numkeys:涉及多少个key值key [key ...]:lua脚本所需访问的keyarg [arg ...]:常规输入参数
语法
local test = KEYS[1]:用来定义变量
if flag == 1 then
redis.log(redis.LOG_NOTICE,test)
else
redis.log(redis.LOG_NOTICE,test .. '!=1')
end : if else 控制语法
return flag:脚本返回的值
函数
redis.call()
执行redis命令
redis.log(level, message)
输出日志