MCPcopy
hub / github.com/redis/go-redis / PSubscribe

Method PSubscribe

ring.go:691–702  ·  view source on GitHub ↗

PSubscribe subscribes the client to the given patterns.

(ctx context.Context, channels ...string)

Source from the content-addressed store, hash-verified

689
690// PSubscribe subscribes the client to the given patterns.
691func (c *Ring) PSubscribe(ctx context.Context, channels ...string) *PubSub {
692 if len(channels) == 0 {
693 panic("at least one channel is required")
694 }
695
696 shard, err := c.sharding.GetByKey(channels[0])
697 if err != nil {
698 // TODO: return PubSub with sticky error
699 panic(err)
700 }
701 return shard.Client.PSubscribe(ctx, channels...)
702}
703
704// SSubscribe Subscribes the client to the specified shard channels.
705func (c *Ring) SSubscribe(ctx context.Context, channels ...string) *PubSub {

Callers

nothing calls this directly

Calls 2

GetByKeyMethod · 0.80
PSubscribeMethod · 0.65

Tested by

no test coverage detected