1. lua脚本整合
local count = redis.call("get","count")
count = redis.call("incr","count")
return count
2. 执行指令
redis直接调用lua脚本
脚本路径: /app/redis/luascript/helloworld.lua
有几个参数: 0
./redis-cli --eval /app/redis/luascript/helloworld.lua 0
加载lua缓存
./redis-cli script help
./redis-cli script load "$(cat /app/redis/luascript/helloworld.lua)"
# 返回hash值
d001e9c8831c255d4733e8ecec32529e884a36f6
# 根据hash值调用参数
./redis-cli evalsha "d001e9c8831c255d4733e8ecec32529e884a36f6" 0