diff --git a/redis.go b/redis.go index 5189040..800028f 100644 --- a/redis.go +++ b/redis.go @@ -8,4 +8,14 @@ import ( type Config = sentinel.Config var NewPool = redis.NewPool +var NewRedisPool = redis.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") +}