mirror of
https://github.com/charlienet/go-mixed.git
synced 2025-07-17 16:12:42 +08:00
redis rename key
This commit is contained in:
@ -143,6 +143,7 @@ func TestRedisPool(t *testing.T) {
|
||||
|
||||
t.Log(client.ConfigGet(context.Background(), "slowlog-log-slower-than").Result())
|
||||
|
||||
// client.FunctionLoadReplace(context.Background(), "")
|
||||
}, redis.RedisOption{
|
||||
Addr: "192.168.123.100:6379",
|
||||
PoolSize: 100,
|
||||
|
@ -49,7 +49,7 @@ func (r renameKey) renameKey(cmd redis.Cmder) {
|
||||
}
|
||||
|
||||
switch strings.ToUpper(cmd.Name()) {
|
||||
case "SELECT":
|
||||
case "SELECT", "FUNCTION":
|
||||
// 无KEY指令
|
||||
case
|
||||
"RENAME", "RENAMENX",
|
||||
@ -69,8 +69,8 @@ func (r renameKey) renameKey(cmd redis.Cmder) {
|
||||
case "MSET", "MSETNX":
|
||||
// 间隔KEY,KEY位置规则1,3,5,7
|
||||
r.rename(args, createSepuence(1, len(args), 2)...)
|
||||
case "EVAL":
|
||||
// 命令中包含键数量 EVAL script numkeys [key [key ...]] [arg [arg ...]]
|
||||
case "EVAL", "EVALSHA", "EVALSHA_RO", "FCALL", "FCALL_RO":
|
||||
// 命令中包含键数量
|
||||
if n, ok := args[2].(int); ok && n > 0 {
|
||||
r.rename(args, createSepuence(3, 3+n, 1)...)
|
||||
}
|
||||
|
@ -21,4 +21,7 @@ func TestEvalName(t *testing.T) {
|
||||
|
||||
_, err := rdb.Eval(context.Background(), "return 1", []string{"a1", "a2", "a3"}, "b1", "b2", "b3").Result()
|
||||
assert.Nil(t, err, err)
|
||||
|
||||
v, err := rdb.FunctionLoadReplace(context.Background(), "#!lua name=mylib\nredis.register_function('myfunc1', function() return 'hello world' end)").Result()
|
||||
t.Log(v, err)
|
||||
}
|
||||
|
Reference in New Issue
Block a user