poolutil

package
Version: v0.0.0-...-ee0865d Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2021 License: MIT, MIT Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type IItem

type IItem interface {
	Reset()
}

type Pool

type Pool struct {
	Creators  *PoolCreators
	ItemMap   map[string][]interface{}
	ItemCount map[string]int
}

func NewPool

func NewPool(creator *PoolCreators) (obj *Pool)

func (*Pool) CreateItem

func (p *Pool) CreateItem(key string) (r interface{})

func (*Pool) GetItem

func (p *Pool) GetItem(key string) (r interface{})

func (*Pool) PutItem

func (p *Pool) PutItem(key string, r interface{})

type PoolCreators

type PoolCreators struct {
	Handler map[string]func() interface{}
}

为了避免使用锁

func NewPoolCreators

func NewPoolCreators() (obj *PoolCreators)

func (*PoolCreators) Dispose

func (p *PoolCreators) Dispose()

func (*PoolCreators) RegisterPoolItem

func (p *PoolCreators) RegisterPoolItem(key string, creator func() interface{})

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL