mirror of
https://github.com/charlienet/go-mixed.git
synced 2025-07-18 00:22:41 +08:00
update redis
This commit is contained in:
@ -53,12 +53,21 @@ type RedisOption struct {
|
||||
|
||||
var _ Client = redisClient{}
|
||||
|
||||
type Clients []Client
|
||||
|
||||
func (clients Clients) LoadFunction(code string) {
|
||||
for _, c := range clients {
|
||||
c.LoadFunction(code)
|
||||
}
|
||||
}
|
||||
|
||||
type Client interface {
|
||||
redis.UniversalClient
|
||||
Prefix() string
|
||||
Separator() string
|
||||
JoinKeys(keys ...string) string
|
||||
FormatKeys(keys ...string) []string
|
||||
LoadFunction(f string) // 加载函数脚本
|
||||
Prefix() string // 统一前缀
|
||||
Separator() string // 分隔符
|
||||
JoinKeys(keys ...string) string // 连接KEY
|
||||
FormatKeys(keys ...string) []string // 格式化KEY
|
||||
}
|
||||
|
||||
type redisClient struct {
|
||||
@ -118,6 +127,10 @@ func (rdb redisClient) Prefix() string {
|
||||
return rdb.prefix
|
||||
}
|
||||
|
||||
func (rdb redisClient) LoadFunction(code string) {
|
||||
rdb.FunctionLoadReplace(context.Background(), code)
|
||||
}
|
||||
|
||||
func (rdb redisClient) Separator() string {
|
||||
return rdb.separator
|
||||
}
|
||||
|
Reference in New Issue
Block a user