feat: 支持 BRPOP BLPOP

This commit is contained in:
2026-01-26 11:54:50 +08:00
parent 37845ba6ea
commit 6ae4736285
3 changed files with 23 additions and 1 deletions

View File

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