Categorygithub.com/go-broadcast/redis
modulepackage
0.2.0
Repository: https://github.com/go-broadcast/redis.git
Documentation: pkg.go.dev

# README

This package allows you to scale out broadcast using Redis.

Installation

go get github.com/go-broadcast/redis

Basic usage

import (
	"log"

	"github.com/go-broadcast/broadcast"
	"github.com/go-broadcast/redis"
)

func main() {
	dispatcher, err := redis.New()
	if err != nil {
		log.Fatal(err)
	}
	
	broadcaster, _, err := broadcast.New(
		broadcast.WithDispatcher(dispatcher),
	)
	if err != nil {
		log.Fatal(err)
	}
}

Full example

Scale out with Redis

# Functions

New creates a redis dispatcher.
WithAddr sets the redis instance address.
WithContext sets the parent Context for publish and subscribe operations.
WithDB sets the redis DB.
WithLogger sets the logger.
WithPassword sets the redis instance password.
WithPrefix sets the prefix of the redis channel name.
WithPublishTimeout sets the timeout when publishing messages to redis.

# Type aliases

Option type defines a redis dispatcher option.