23 lines
385 B
Go
23 lines
385 B
Go
package redis
|
|
|
|
import (
|
|
"context"
|
|
"time"
|
|
|
|
"git.loafle.net/commons_go/config"
|
|
rp "git.loafle.net/commons_go/redis_pool"
|
|
)
|
|
|
|
func NewPool(ctx context.Context) rp.Pool {
|
|
h := &poolHandlers{
|
|
ctx: 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
|
|
}
|