Documentation
¶
Index ¶
Constants ¶
View Source
const ( ConstDatabaseConnectTimeout = 10000 ConstHealthCheckInterval = 5000 ConstDatabaseReadTimeout = 10000 ConstDatabaseWriteTimeout = 10000 ConstProbeContextTimeout = 5000 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config 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"` // DB的名称或编号 MinIdle int `json:"minIdle,omitempty" yaml:"minIdle,omitempty"` // 最小空闲连接数(针对于连接池) MaxOpen int `json:"maxOpen,omitempty" yaml:"maxOpen,omitempty"` // 最大打开连接数(针对于连接池) }
type FeatureOpts ¶
type FeatureOpts struct {
EnableMetrics bool `json:"enableMetrics,omitempty" yaml:"enableMetrics,omitempty"` // 开启 metrics 记录
}
func NewDefaultFeatureOpts ¶
func NewDefaultFeatureOpts() *FeatureOpts
type Pool ¶
type Pool struct {
// contains filtered or unexported fields
}
func NewRedisClient ¶
func NewRedisClient(clientConf *Config, featureOpts *FeatureOpts) *Pool
func (*Pool) GetSession ¶
func (*Pool) GetUnSafeClient ¶
func (p *Pool) GetUnSafeClient() *redis.Client
Click to show internal directories.
Click to hide internal directories.