// NewWatcher return new watcher service.
NewWatcher return new watcher service.
// NewWatcher return new watcher service .
func NewWatcher(client *redis.Client, setters ...WatcherOption) persist.Watcher {
	id, err := uuid.NewRandom()
	if err != nil {
		panic(err)
	}
	w := &Watcher{
		quit:     make(chan bool),
		channels: make(chan string),
		callback: make(map[string]func(string)),
		id:       id,
	}
	for _, setter := range setters {
		setter(&w.options)
	}
	w.conn = client
	go func() {
		err := w.subscribe()
		if err != nil {
			panic(err)
		}
	}()
	return w
}
func NewWatcher ( client * redis . Client , setters ... WatcherOption ) persist . Watcher { id , err := uuid . NewRandom ( ) if err != nil { panic ( err ) } w := & Watcher { quit : make ( chan bool ) , channels : make ( chan string ) , callback : make ( map [ string ] func ( string ) ) , id : id , } for _ , setter := range setters { setter ( & w . options ) } w . conn = client go func ( ) { err := w . subscribe ( ) if err != nil { panic ( err ) } } ( ) return w }
NewWatcher return new watcher service.
NewWatcher return new watcher service .