redis/export_test.go

35 lines
750 B
Go
Raw Normal View History

2013-11-07 18:20:15 +04:00
package redis
2016-03-17 19:00:47 +03:00
import (
"time"
2017-02-18 17:42:34 +03:00
"github.com/go-redis/redis/internal/pool"
2016-03-17 19:00:47 +03:00
)
func (c *baseClient) Pool() pool.Pooler {
2013-11-07 18:20:15 +04:00
return c.connPool
}
2015-03-23 11:23:33 +03:00
func (c *PubSub) Pool() pool.Pooler {
return c.base.connPool
}
2016-03-17 19:00:47 +03:00
2016-04-09 14:52:01 +03:00
func (c *PubSub) ReceiveMessageTimeout(timeout time.Duration) (*Message, error) {
return c.receiveMessage(timeout)
2016-03-17 19:00:47 +03:00
}
func (c *ClusterClient) SlotAddrs(slot int) []string {
var addrs []string
for _, n := range c.state().slotNodes(slot) {
addrs = append(addrs, n.Client.getAddr())
}
return addrs
}
// SwapSlot swaps a slot's master/slave address for testing MOVED redirects.
func (c *ClusterClient) SwapSlotNodes(slot int) []string {
nodes := c.state().slots[slot]
nodes[0], nodes[1] = nodes[1], nodes[0]
return c.SlotAddrs(slot)
}