deprecated_overflow_gateway.../redis/pool.go

25 lines
461 B
Go
Raw Normal View History

2017-09-11 02:24:18 +00:00
package redis
import (
"context"
"time"
"git.loafle.net/commons_go/config"
"git.loafle.net/commons_go/logging"
rp "git.loafle.net/commons_go/redis_pool"
)
func NewPool(ctx context.Context) rp.Pool {
h := &poolHandlers{
ctx: ctx,
logger: logging.WithContext(ctx),
}
h.cfg = config.Sub("redis")
h.MaxIdle = h.cfg.GetInt("pool.MaxIdle")
h.IdleTimeout = h.cfg.GetDuration("pool.IdleTimeout") * time.Second
p := rp.NewPool(ctx, h)
return p
}