1
0
mirror of https://github.com/charlienet/go-mixed.git synced 2025-07-18 00:22:41 +08:00

优化redis eval的key重命名

This commit is contained in:
2023-10-26 15:47:33 +08:00
parent 91a5a7d612
commit 5a17236fd7
5 changed files with 30 additions and 16 deletions

View File

@ -20,7 +20,7 @@ const (
var Nil = redis.Nil
type ReidsOption struct {
type RedisOption struct {
Addr string
Addrs []string
Password string // 密码
@ -67,7 +67,7 @@ type redisClient struct {
separator string
}
func New(opt *ReidsOption) redisClient {
func New(opt *RedisOption) redisClient {
var rdb redisClient
if len(opt.Addrs) == 0 && len(opt.Addr) > 0 {
@ -114,12 +114,6 @@ func New(opt *ReidsOption) redisClient {
return rdb
}
func (rdb redisClient) Eval(ctx context.Context, script string, keys []string, args ...interface{}) *redis.Cmd {
newKeys := rdb.FormatKeys(keys...)
return rdb.UniversalClient.Eval(ctx, script, newKeys, args...)
}
func (rdb redisClient) Prefix() string {
return rdb.prefix
}