This commit is contained in:
bryanqiu 2024-06-21 17:50:17 +08:00
parent 182d21c5fd
commit 67fdd829fb

View File

@ -1,20 +1,20 @@
package redis package redis
import ( import (
redigo "github.com/gomodule/redigo/redis"
"qoobing.com/gomod/redis/redis" "qoobing.com/gomod/redis/redis"
"qoobing.com/gomod/redis/sentinel" "qoobing.com/gomod/redis/sentinel"
) )
type Config = sentinel.Config type Config = sentinel.Config
var NewPool = redis.NewPool
var NewRedisPool = redis.NewPool var NewRedisPool = redis.NewPool
var NewSentinelPool = sentinel.NewPool var NewSentinelPool = sentinel.NewPool
func NewPool(cfg Config) *redis.Pool { func NewPool(cfg Config) *redigo.Pool {
if cfg.Master != "" { if cfg.Master != "" {
return NewRedisPool(cfg) return NewRedisPool(cfg)
} else if cfg.MasterName { } else if cfg.MasterName != "" {
return NewSentinelPool(cfg) return NewSentinelPool(cfg)
} }
panic("invalid config: Master & MasterName are both empty") panic("invalid config: Master & MasterName are both empty")