mirror of
https://github.com/Icinga/icingadb.git
synced 2026-05-28 04:35:54 -04:00
Redis: Add HMGet()
This commit is contained in:
parent
ddd64e7504
commit
e6eb55207f
1 changed files with 21 additions and 0 deletions
21
redis.go
21
redis.go
|
|
@ -64,6 +64,7 @@ type RedisClient interface {
|
|||
XRead(a *redis.XReadArgs) *redis.XStreamSliceCmd
|
||||
XDel(stream string, ids ...string) *redis.IntCmd
|
||||
HKeys(key string) *redis.StringSliceCmd
|
||||
HMGet(key string, fields ...string) *redis.SliceCmd
|
||||
HGetAll(key string) *redis.StringStringMapCmd
|
||||
TxPipelined(fn func(redis.Pipeliner) error) ([]redis.Cmder, error)
|
||||
Pipeline() redis.Pipeliner
|
||||
|
|
@ -260,6 +261,26 @@ func (rdbw *RDBWrapper) HKeys(key string) *redis.StringSliceCmd {
|
|||
}
|
||||
}
|
||||
|
||||
func (rdbw * RDBWrapper) HMGet(key string, fields ...string) *redis.SliceCmd {
|
||||
for {
|
||||
if !rdbw.IsConnected() {
|
||||
rdbw.WaitForConnection()
|
||||
continue
|
||||
}
|
||||
|
||||
cmd := rdbw.Rdb.HMGet(key, fields...)
|
||||
_, err := cmd.Result()
|
||||
|
||||
if err != nil {
|
||||
if !rdbw.CheckConnection(false) {
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
||||
return cmd
|
||||
}
|
||||
}
|
||||
|
||||
// Wrapper for auto-logging and connection handling
|
||||
func (rdbw *RDBWrapper) HGetAll(key string) *redis.StringStringMapCmd {
|
||||
for {
|
||||
|
|
|
|||
Loading…
Reference in a new issue