Documentation ¶
Index ¶
- type Cluster
- func (c *Cluster) GetConnByAddr(addr string) (conn redis.Conn, isReadOnly bool, err error)
- func (c *Cluster) GetMasterFromSlaveIP(slaveIP string) (masterIP string, err error)
- func (c *Cluster) GetMasterIPs() (masterIPs []string)
- func (c *Cluster) GetNodeIPBySlot(slot int, readOnly bool) (nodeIP string, err error)
- func (c *Cluster) GetSlaveIPs() (slaveIPs []string)
- func (c *Cluster) HandleError(err error)
- func (c *Cluster) InitClusterRegistry() (err error)
- func (c *Cluster) Slot(key string) int
- func (c *Cluster) Stats() map[string]redis.PoolStats
- type ClusterInterface
- type RedirError
- type SlotMap
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cluster ¶
type Cluster struct { CreatePool func(host string, maxConn int, dialOption ...redis.DialOption) *redis.Pool // contains filtered or unexported fields }
func (*Cluster) GetConnByAddr ¶
getConnFromAddr ...
func (*Cluster) GetMasterFromSlaveIP ¶
func (*Cluster) GetMasterIPs ¶
func (*Cluster) GetNodeIPBySlot ¶
func (*Cluster) GetSlaveIPs ¶
func (*Cluster) HandleError ¶
func (*Cluster) InitClusterRegistry ¶
type ClusterInterface ¶
type ClusterInterface interface { GetMasterIPs() (masterIPs []string) GetMasterFromSlaveIP(slaveIP string) (masterIP string, err error) GetSlaveIPs() (slaveIPs []string) GetConnByAddr(addr string) (conn redis.Conn, isReadOnly bool, err error) GetNodeIPBySlot(slot int, readOnly bool) (nodeIP string, err error) Slot(key string) int HandleError(err error) // contains filtered or unexported methods }
func New ¶
func New(allIPs []string, maxConn int, createPool func(host string, maxConn int, dialOption ...redis.DialOption) *redis.Pool, dialOption ...redis.DialOption) ClusterInterface
type RedirError ¶
type RedirError struct { // Type indicates if the redirection is a MOVED or an ASK. Type string // NewSlot is the slot number of the redirection. NewSlot int // Addr is the node address to redirect to. Addr string // contains filtered or unexported fields }
func ParseRedir ¶
func ParseRedir(err error) *RedirError
ParseRedir parses err into a RedirError. If err is not a MOVED or ASK error or if it is nil, it returns nil.
func (*RedirError) Error ¶
func (e *RedirError) Error() string
Error returns the error message of a RedirError. This is the message as received from redis.
Click to show internal directories.
Click to hide internal directories.