1
0
Fork 0
mirror of https://github.com/eosswedenorg/thalos synced 2026-06-16 04:24:56 +02:00

redis/wrapper.go: Adding XAdd()

This commit is contained in:
Henrik Hautakoski 2022-06-28 14:02:52 +02:00
parent 953113b456
commit fb0ecce6c2

View file

@ -48,6 +48,18 @@ func Publish(channel string, message interface{}) (*_redis.IntCmd) {
return rdb.Publish(redisCtx, channel, message)
}
func XAdd(stream string, id string, maxlen int64, message map[string]interface{}) (*_redis.StringCmd) {
args := &_redis.XAddArgs{
Stream: stream,
ID: id,
MaxLenApprox: maxlen,
Values: message,
}
return rdb.XAdd(redisCtx, args)
}
func RegisterPublish(channel string, message interface{}) (*_redis.IntCmd) {
return redis_pipe.Publish(redisCtx, channel, message)
}