redis add bitcount (#483)

Co-authored-by: zhoudeyu <zhoudeyu@xiaoheiban.cn>
This commit is contained in:
Zcc、
2021-02-19 11:41:01 +08:00
committed by GitHub
parent 086113c843
commit 72580dee38
2 changed files with 50 additions and 0 deletions

View File

@@ -108,6 +108,23 @@ func (s *Redis) BlpopEx(redisNode RedisNode, key string) (string, bool, error) {
return vals[1], true, nil
}
func (s *Redis) BitCount(key string, start, end int64) (val int64, err error) {
err = s.brk.DoWithAcceptable(func() error {
conn, err := getRedis(s)
if err != nil {
return err
}
val, err = conn.BitCount(key, &red.BitCount{
Start: start,
End: end,
}).Result()
return err
}, acceptable)
return
}
func (s *Redis) Del(keys ...string) (val int, err error) {
err = s.brk.DoWithAcceptable(func() error {
conn, err := getRedis(s)