|
@@ -36,7 +36,7 @@ type Config struct { |
|
|
var pool *redigo.Pool |
|
|
var pool *redigo.Pool |
|
|
var conf *Config |
|
|
var conf *Config |
|
|
|
|
|
|
|
|
func NewRedis(addr string) { |
|
|
|
|
|
|
|
|
func NewRedis(addr, pwd string) { |
|
|
if addr == "" { |
|
|
if addr == "" { |
|
|
panic("\nredis connect string cannot be empty\n") |
|
|
panic("\nredis connect string cannot be empty\n") |
|
|
} |
|
|
} |
|
@@ -48,6 +48,7 @@ func NewRedis(addr string) { |
|
|
Wait: true, |
|
|
Wait: true, |
|
|
Dial: func() (redigo.Conn, error) { |
|
|
Dial: func() (redigo.Conn, error) { |
|
|
c, err := redigo.Dial("tcp", addr, |
|
|
c, err := redigo.Dial("tcp", addr, |
|
|
|
|
|
redigo.DialPassword(pwd), |
|
|
redigo.DialConnectTimeout(redisDialTTL), |
|
|
redigo.DialConnectTimeout(redisDialTTL), |
|
|
redigo.DialReadTimeout(redisReadTTL), |
|
|
redigo.DialReadTimeout(redisReadTTL), |
|
|
redigo.DialWriteTimeout(redisWriteTTL), |
|
|
redigo.DialWriteTimeout(redisWriteTTL), |
|
|