Manage resources such as database connections etc. with this package.
Pool can be configured by using the options struct while initializing it. The pre and post hooks can be used to test resource. The eviction policy can be set by the resource as well.
The pool will test for freshness on a schedule set by the client.
go get github.com/avarghes1/go_pool/pool
import github.com/avarghes1/go_pool/pool
r := new(Testresource)
p, _ := pool.Initialize(r, pool.Options{PoolSize: 10,
Timeout: time.Second,
EvictionTest: true,
EvictTestSchedule: time.Second * 1})
for i := 0; i < 10; i++ {
a, err := p.Acquire()
fmt.Println("%+v %+v", a, err)
p.Release(a)
}