2017-09-11 02:24:18 +00:00
|
|
|
package redis
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
"time"
|
|
|
|
|
|
|
|
rp "git.loafle.net/commons_go/redis_pool"
|
2017-09-19 08:38:59 +00:00
|
|
|
"git.loafle.net/overflow/overflow_gateway_probe/conf"
|
2017-09-11 02:24:18 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
func NewPool(ctx context.Context) rp.Pool {
|
|
|
|
h := &poolHandlers{
|
2017-09-11 04:42:52 +00:00
|
|
|
ctx: ctx,
|
2017-09-11 02:24:18 +00:00
|
|
|
}
|
2017-09-19 08:38:59 +00:00
|
|
|
h.MaxIdle = conf.Config.Redis.Pool.MaxIdle
|
|
|
|
h.IdleTimeout = conf.Config.Redis.Pool.IdleTimeout * time.Second
|
2017-09-11 02:24:18 +00:00
|
|
|
|
|
|
|
p := rp.NewPool(ctx, h)
|
|
|
|
|
|
|
|
return p
|
|
|
|
}
|