Versions in this module Expand all Collapse all v0 v0.0.3 Feb 2, 2021 v0.0.2 Jan 22, 2021 Changes in this version + const DefaultAutoEvict + const DefaultEvictInterval + const DefaultMaxIdle + const DefaultMaxSize + const DefaultMaxValidateAttempts + const DefaultMinIdle + const DefaultMinIdleTime + const DefaultNonblocking + var DefaultObjectDestroyFactory ObjectDestroyFactory = func(ctx context.Context, object interface{}) error + var DefaultObjectValidateFactory ObjectValidateFactory = func(ctx context.Context, object interface{}) bool + var ErrObjectCreateFactoryNotFound = errors.New("the factory of object creating not found") + var ErrObjectNotFound = errors.New("object not found") + var ErrObjectValidateFailed = errors.New("object validate failed") + var ErrPoolClosed = errors.New("pool has been closed") + var ErrPoolExhausted = errors.New("pool is exhausted") + var ErrPoolFulled = errors.New("pool is full") + type Config struct + AutoEvict bool + EvictInterval time.Duration + MaxIdle int + MaxSize int + MaxValidateAttempts int + MinIdle int + MinIdleTime time.Duration + Nonblocking bool + ObjectCreateFactory ObjectCreateFactory + ObjectDestroyFactory ObjectDestroyFactory + ObjectValidateFactory ObjectValidateFactory + func NewConfig(objectCreateFactory ObjectCreateFactory) Config + func NewDefaultConfig() Config + type ObjectCreateFactory func(ctx context.Context) (interface{}, error) + type ObjectDestroyFactory func(ctx context.Context, object interface{}) error + type ObjectValidateFactory func(ctx context.Context, object interface{}) bool + type Pool struct + func New(config Config) (*Pool, error) + func (p *Pool) ActiveSize() int + func (p *Pool) BorrowObject(ctx context.Context) (interface{}, error) + func (p *Pool) Close(ctx context.Context) error + func (p *Pool) Evict(ctx context.Context) error + func (p *Pool) IdleSize() int + func (p *Pool) InvalidateObject(ctx context.Context, object interface{}) error + func (p *Pool) ReturnObject(ctx context.Context, object interface{}) error + func (p *Pool) Size() int + func (p *Pool) StartEvictor()