feat: 支持 BRPOP BLPOP
This commit is contained in:
20
wrapper.go
20
wrapper.go
@@ -91,3 +91,23 @@ func (w *wrapper) HSet(ctx context.Context, instanceFlag string, key string, fie
|
||||
func (w *wrapper) HDel(ctx context.Context, instanceFlag string, key string, fieldList ...string) *define.RedisResult {
|
||||
return Client.Exec(ctx, instanceFlag, consts.RedisCommandHdel, key, strings.Join(fieldList, " "))
|
||||
}
|
||||
|
||||
// BRPop ...
|
||||
func (w *wrapper) BRPop(ctx context.Context, instanceFlag string, key []string, timeout int64) *define.RedisResult {
|
||||
paramList := []any{}
|
||||
for _, item := range key {
|
||||
paramList = append(paramList, item)
|
||||
}
|
||||
paramList = append(paramList, timeout)
|
||||
return Client.Exec(ctx, instanceFlag, consts.RedisCommandBrpop, paramList...)
|
||||
}
|
||||
|
||||
// BLPop ...
|
||||
func (w *wrapper) BLPop(ctx context.Context, instanceFlag string, key []string, timeout int64) *define.RedisResult {
|
||||
paramList := []any{}
|
||||
for _, item := range key {
|
||||
paramList = append(paramList, item)
|
||||
}
|
||||
paramList = append(paramList, timeout)
|
||||
return Client.Exec(ctx, instanceFlag, consts.RedisCommandBlpop, paramList...)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user