Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConstructorFunc ¶
ConstructorFunc will be called for any uninitialized resource upon fetch from pool
type DestructorFunc ¶
DestructorFunc will be called for any closed resource before it will be returned to pool
type Pool ¶
type Pool[T any] struct { // contains filtered or unexported fields }
Pool represents thread-safe generic resource pool of fixed size
type PoolOpt ¶
func WithConstructor ¶
func WithConstructor[T any](fn ConstructorFunc[T]) PoolOpt[T]
func WithDestructor ¶
func WithDestructor[T any](fn DestructorFunc[T]) PoolOpt[T]
type Resource ¶
type Resource[T any] struct { // contains filtered or unexported fields }
Resource represents generic reusable resource
func (*Resource[T]) Close ¶
Close deinitializes resource and returns it back to pool. Be aware that resource can to closed exactly once to avoid data race conditions and resource leaks
Click to show internal directories.
Click to hide internal directories.