Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrNoSuitableSizeClass = errors.New("no suitable size class")
ErrNoSuitableSizeClass no suitable pool of size
View Source
var ErrPoolLimit = errors.New("resource pool limit")
ErrPoolLimit pool elements exceed its capacity
Functions ¶
func SetReleaseInterval ¶
SetReleaseInterval set release interval duration
Types ¶
type MemPool ¶
type MemPool struct {
// contains filtered or unexported fields
}
MemPool reused buffer pool
func NewMemPool ¶
NewMemPool returns a MemPool within chan pool
func NewMemPoolWith ¶
NewMemPoolWith new MemPool with size-class and self-defined pool
type Pool ¶
type Pool interface { // Get return nil and error if exceed pool's capacity Get() (interface{}, error) Put(x interface{}) Cap() int Len() int // Idle return cached idle objects in pool. Idle() int }
Pool resource pool support for sync.pool and capacity limit release resource if no used anymore no limit if capacity is negative
func NewChanPool ¶
NewChanPool return Pool with capacity, no limit if capacity is negative
Click to show internal directories.
Click to hide internal directories.