1
0
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:
2023-11-03 15:04:40 +08:00
parent 5f065de145
commit 2f2af226ee
4 changed files with 24 additions and 13 deletions

View File

@ -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
}