redisclient

package
v3.0.2+incompatible Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 11, 2019 License: MIT Imports: 6 Imported by: 5

Documentation

Index

Constants

View Source
const (
	//CLUSTER_MODE 0
	CLUSTER_MODE int = iota
	// SINGLE_MODE 1
	SINGLE_MODE
)

Variables

This section is empty.

Functions

This section is empty.

Types

type RedisClient

type RedisClient interface {
	GetHosts() ([]string, []string)
	GetMaxConn() int
	GetConn(host string) (redis.Conn, bool, error)
	GetConnWithTimeout(host string) (cwt redis.ConnWithTimeout, isReadOnly bool, err error)
	GetNodeIPByKey(key string, readOnly bool) (string, error)
	GetMasterFromSlaveIP(slaveIP string) (masterIP string, err error)
	HandleError(err error)
}

RedisClient ...

func New

func New(mode int, host string, maxConn int, dialOption ...redis.DialOption) RedisClient

New return new RedisClient

type RedisClientImpl

type RedisClientImpl struct {
	// contains filtered or unexported fields
}

RedisClientImpl implementation of Redis Single Node Client

func (*RedisClientImpl) GetConn

func (c *RedisClientImpl) GetConn(host string) (conn redis.Conn, isReadOnly bool, err error)

func (*RedisClientImpl) GetConnWithTimeout

func (c *RedisClientImpl) GetConnWithTimeout(host string) (cwt redis.ConnWithTimeout, isReadOnly bool, err error)

func (*RedisClientImpl) GetHosts

func (c *RedisClientImpl) GetHosts() ([]string, []string)

GetHosts get hosts of client

func (*RedisClientImpl) GetMasterFromSlaveIP

func (c *RedisClientImpl) GetMasterFromSlaveIP(slaveIP string) (string, error)

func (*RedisClientImpl) GetMaxConn

func (c *RedisClientImpl) GetMaxConn() int

GetMaxConn Return Redis Single Node Max Connection Pool

func (*RedisClientImpl) GetMode

func (c *RedisClientImpl) GetMode() int

GetMode get mode of client

func (*RedisClientImpl) GetNodeIPByKey

func (c *RedisClientImpl) GetNodeIPByKey(key string, readOnly bool) (string, error)

func (*RedisClientImpl) HandleError

func (c *RedisClientImpl) HandleError(err error)

type RedisClusterV2ClientImpl

type RedisClusterV2ClientImpl struct {
	// contains filtered or unexported fields
}

func (*RedisClusterV2ClientImpl) GetConn

func (c *RedisClusterV2ClientImpl) GetConn(host string) (conn redis.Conn, isReadOnly bool, err error)

func (*RedisClusterV2ClientImpl) GetConnWithTimeout

func (c *RedisClusterV2ClientImpl) GetConnWithTimeout(host string) (cwt redis.ConnWithTimeout, isReadOnly bool, err error)

func (*RedisClusterV2ClientImpl) GetHosts

func (c *RedisClusterV2ClientImpl) GetHosts() ([]string, []string)

GetHosts get hosts of client

func (*RedisClusterV2ClientImpl) GetMasterFromSlaveIP

func (c *RedisClusterV2ClientImpl) GetMasterFromSlaveIP(slaveIP string) (string, error)

func (*RedisClusterV2ClientImpl) GetMaxConn

func (c *RedisClusterV2ClientImpl) GetMaxConn() int

func (*RedisClusterV2ClientImpl) GetNodeIPByKey

func (c *RedisClusterV2ClientImpl) GetNodeIPByKey(key string, readOnly bool) (string, error)

func (*RedisClusterV2ClientImpl) HandleError

func (c *RedisClusterV2ClientImpl) HandleError(err error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL