Skip to content

Commit 838edb0

Browse files
Added HIncrBy()
1 parent ecf71fc commit 838edb0

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

internal/redis/redis.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ type RedisClient interface {
2121
PSubscribe(ctx context.Context, patterns ...string) (*redis.PubSub, error)
2222
HGetAll(ctx context.Context, key string) *redis.MapStringStringCmd
2323
FlushAll(ctx context.Context) error
24+
HIncrBy(ctx context.Context, key, field string, incr int64) *redis.IntCmd
2425
}
2526

2627
/* redisClient implementation */
@@ -105,3 +106,8 @@ func (r *redisClient) HGetAll(ctx context.Context, key string) *redis.MapStringS
105106
func (r *redisClient) FlushAll(ctx context.Context) error {
106107
return r.client.FlushAll(ctx).Err()
107108
}
109+
110+
/* increment the value of the field in the hash */
111+
func (r *redisClient) HIncrBy(ctx context.Context, key, field string, incr int64) *redis.IntCmd {
112+
return r.client.HIncrBy(ctx, key, field, incr)
113+
}

0 commit comments

Comments
 (0)