featrue: NewPool
This commit is contained in:
parent
ace40d5502
commit
182d21c5fd
10
redis.go
10
redis.go
@ -8,4 +8,14 @@ import (
|
|||||||
type Config = sentinel.Config
|
type Config = sentinel.Config
|
||||||
|
|
||||||
var NewPool = redis.NewPool
|
var NewPool = redis.NewPool
|
||||||
|
var NewRedisPool = redis.NewPool
|
||||||
var NewSentinelPool = sentinel.NewPool
|
var NewSentinelPool = sentinel.NewPool
|
||||||
|
|
||||||
|
func NewPool(cfg Config) *redis.Pool {
|
||||||
|
if cfg.Master != "" {
|
||||||
|
return NewRedisPool(cfg)
|
||||||
|
} else if cfg.MasterName {
|
||||||
|
return NewSentinelPool(cfg)
|
||||||
|
}
|
||||||
|
panic("invalid config: Master & MasterName are both empty")
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user