Documentation
¶
Index ¶
- func Client(name string) (r rds.Conn)
- func DefaultClient() (r rds.Conn)
- func DefaultPool() (r *rds.Pool)
- func HasError(err error) bool
- func NewRedisPool(cfg *Cfg) *rds.Pool
- func Pool(name string) (r *rds.Pool)
- func SafeClient(name string) (r rds.Conn, err error)
- func SafePool(name string) (r *rds.Pool, err error)
- func Valid(names ...string) (err error)
- type Cfg
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultClient ¶
func DefaultPool ¶
func NewRedisPool ¶
Types ¶
type Cfg ¶
type Cfg struct {
// dial
DialAddr string `toml:"addr"`
DialUsername string `toml:"user"`
DialPassword string `toml:"pawd"`
DialDatabase int `toml:"database"`
DialConnectTimeout time.Duration `toml:"dial_timeout"`
DialReadTimeout time.Duration `toml:"read_timeout"`
DialWriteTimeout time.Duration `toml:"write_timeout"`
// pool
PoolMaxIdle int `toml:"pool_max_idle"` // 最大闲置连接数
PoolMaxActive int `toml:"pool_max_active"` // 最大活跃连接数
PoolIdleTimeout time.Duration `toml:"pool_idle_time"` // 闲置的过期时间,在Get方法中会对过期的连接删除
PoolWait bool `toml:"pool_wait"` // 当活跃连接达到上限,Get时是等待还是返回错误。为false时返回错误,为true时阻塞等待
PoolMaxConnLifetime time.Duration `toml:"pool_max_conn_life_time"` // 连接最长生存时间,当超过时间会被删除
}
Click to show internal directories.
Click to hide internal directories.
