pool

package
v0.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 11, 2023 License: GPL-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultPoolMaxSize = 16

Variables

This section is empty.

Functions

This section is empty.

Types

type Item

type Item[T any] struct {
	// contains filtered or unexported fields
}

type Pool

type Pool[T any] struct {
	// contains filtered or unexported fields
}

func NewPool

func NewPool[T any](ctx context.Context, maxSize int, idleTimeout time.Duration, newFunc func(ctx context.Context) (T, error), closeFunc func(T)) *Pool[T]

func (*Pool[T]) Close

func (p *Pool[T]) Close()

func (*Pool[T]) Get

func (p *Pool[T]) Get(ctx context.Context) (T, error)

func (*Pool[T]) Put

func (p *Pool[T]) Put(ctx context.Context, v T) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL