mirror of
https://github.com/redis/go-redis.git
synced 2025-07-28 06:42:00 +03:00
Move Publish channel to cmdable. Remove method that was deprecated in v3.
This commit is contained in:
21
redis.go
21
redis.go
@ -215,3 +215,24 @@ func (c *Client) pipelineExec(cmds []Cmder) error {
|
||||
}
|
||||
return retErr
|
||||
}
|
||||
|
||||
func (c *Client) pubSub() *PubSub {
|
||||
return &PubSub{
|
||||
base: baseClient{
|
||||
opt: c.opt,
|
||||
connPool: pool.NewStickyConnPool(c.connPool.(*pool.ConnPool), false),
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
// Subscribe subscribes the client to the specified channels.
|
||||
func (c *Client) Subscribe(channels ...string) (*PubSub, error) {
|
||||
pubsub := c.pubSub()
|
||||
return pubsub, pubsub.Subscribe(channels...)
|
||||
}
|
||||
|
||||
// PSubscribe subscribes the client to the given patterns.
|
||||
func (c *Client) PSubscribe(channels ...string) (*PubSub, error) {
|
||||
pubsub := c.pubSub()
|
||||
return pubsub, pubsub.PSubscribe(channels...)
|
||||
}
|
||||
|
Reference in New Issue
Block a user