xpool

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2020 License: MIT Imports: 6 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ExpireFunc

type ExpireFunc func(interface{})

type NewFunc

type NewFunc func() (interface{}, error)

type TPool

type TPool struct {
	Expire     time.Duration
	NewFunc    func() (interface{}, error)
	ExpireFunc func(interface{})
	// contains filtered or unexported fields
}

线程池

func New

func New(expire time.Duration, newFunc NewFunc, expireFunc ...ExpireFunc) *TPool

func (*TPool) Clear

func (p *TPool) Clear()

清空线程池

func (*TPool) Close

func (p *TPool) Close()

关闭线程池

func (*TPool) Get

func (p *TPool) Get() (interface{}, error)

从线程池中获取一项

func (*TPool) Put

func (p *TPool) Put(value interface{})

对象放入到线程池

func (*TPool) Size

func (p *TPool) Size() int

获取池大小

Jump to

Keyboard shortcuts

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