pool

package
v1.2.9 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2023 License: GPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrClosed = errors.New("pool closed")
	ErrMax    = errors.New("reach max connection limit")
)

Functions

This section is empty.

Types

type Config

type Config struct {
	MaxIdle   uint
	MaxActive uint
}

type Pool

type Pool struct {
	Config
	// contains filtered or unexported fields
}

Pool stores object for reusing, such as redis connection

func New

func New(factory func() (interface{}, error), finalizer func(x interface{}), cfg Config) *Pool

func (*Pool) Close

func (pool *Pool) Close()

func (*Pool) Get

func (pool *Pool) Get() (interface{}, error)

func (*Pool) Put

func (pool *Pool) Put(x interface{})

Jump to

Keyboard shortcuts

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