dev
This commit is contained in:
parent
ace40d5502
commit
576807b94e
18
redis.go
18
redis.go
@ -1,11 +1,25 @@
|
||||
package redis
|
||||
|
||||
import (
|
||||
redigo "github.com/gomodule/redigo/redis"
|
||||
"qoobing.com/gomod/redis/redis"
|
||||
"qoobing.com/gomod/redis/sentinel"
|
||||
)
|
||||
|
||||
type Config = sentinel.Config
|
||||
type (
|
||||
Conn = redigo.Conn
|
||||
Pool = redigo.Pool
|
||||
Config = sentinel.Config
|
||||
)
|
||||
|
||||
var NewPool = redis.NewPool
|
||||
var NewRedisPool = redis.NewPool
|
||||
var NewSentinelPool = sentinel.NewPool
|
||||
|
||||
func NewPool(cfg Config) *redigo.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