Documentation ¶
Index ¶
Constants ¶
View Source
const ( ConstDbConnectTimeoutSec = 10 ConstHealthCheckStopTimeoutSec = 5 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct { RedisDb *redis.Client // contains filtered or unexported fields }
func NewRedisClient ¶
func NewRedisClient(config *ClientConf) *Client
func (*Client) Close ¶
func (c *Client) Close()
Close 这里优化了关闭顺序,优先健康监测关闭,要不然关闭出现监测失败 指针表示当前对象地址,没有指针表示数据副本是一个copy
func (*Client) HealthCheck ¶
type ClientConf ¶
type ClientConf struct { Address string `json:"address" yaml:"address"` Port uint16 `json:"port" yaml:"port"` ReadTimeout uint32 `json:"readTimeout,omitempty" yaml:"readTimeout,omitempty"` WriteTimeout uint32 `json:"writeTimeout,omitempty" yaml:"writeTimeout,omitempty"` Password string `json:"password" yaml:"password"` DB uint8 `json:"db" yaml:"db"` MinIdle int `json:"minIdle,omitempty" yaml:"minIdle,omitempty"` MaxOpen int `json:"maxOpen,omitempty" yaml:"maxOpen,omitempty"` }
Click to show internal directories.
Click to hide internal directories.