redis加载lua脚本的示例:
基本用法:
EVAL script numkeys key [key ...] arg [arg ...]
numkeys 是key的个数,后边接着写key1 key2... val1 val2....,举例:
127.0.0.1:6379> eval "return {KEYS[1],KEYS[2],ARGV[1],ARGV[2]}" 2 key1 key2 val1 val21) "key1"2) "key2"3) "val1"4) "val2"
127.0.0.1:6379> eval "return {KEYS[1],KEYS[2],ARGV[1],ARGV[2]}" 2 key1 key2 val1 val2
1) "key1"
2) "key2"
3) "val1"
4) "val2"