You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
17 lines
377 B
17 lines
377 B
8 months ago
|
package redispubsub
|
||
|
|
||
|
import "github.com/redis/go-redis/v9"
|
||
|
|
||
|
type Publisher struct {
|
||
|
client redis.UniversalClient
|
||
|
channel string
|
||
|
}
|
||
|
|
||
|
func NewPublisher(client redis.UniversalClient, channel string) *Publisher {
|
||
|
return &Publisher{client: client, channel: channel}
|
||
|
}
|
||
|
|
||
|
func (p *Publisher) Publish(message string) error {
|
||
|
return p.client.Publish(ctx, p.channel, message).Err()
|
||
|
}
|