example

package
v0.0.0-...-8d22ec3 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2025 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Pool

type Pool struct {
	sync.Mutex
	Inuse     []interface{}
	Available []interface{}
	// contains filtered or unexported fields
}

对象池

func NewPool

func NewPool(new func() interface{}) *Pool

创建一个新对象池

func (*Pool) Acquire

func (p *Pool) Acquire() interface{}

从池中获取要使用的新池对象。 如果没有可用,则获取创建1个池对象的新实例

func (*Pool) Release

func (p *Pool) Release(object interface{})

将对象释放回对象池

Jump to

Keyboard shortcuts

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