1.获取多个key值
local result ={} for i = 1,#(KEYS) do result[i]= redis.call('get',KEYS[i]) end return result
redis-cli示例:
eval "local result={} for i = 1,#(KEYS) do result[i]= redis.call('get',KEYS[i]) end return result" 1 a
2.获取多个hash值
local result ={} local temp for i = 1,#(KEYS) do temp= redis.call('hgetall', KEYS[i]) result[i]=table.concat(temp,' ') end return result
redis-cli示例:
eval "local result ={} local temp for i = 1,#(KEYS) do temp = redis.call('hgetall', KEYS[i]) result[i]=table.concat(temp,' ') end return result" 1 a
参考: