Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Pool ¶
type Pool struct {
// contains filtered or unexported fields
}
Pool maintains a pool of elements available for reuse.
func New ¶
func New(lifetime time.Duration, newFunc func() (interface{}, error), expiredFunc func(interface{})) *Pool
New returns a new pool, where items in the pool have the given lifetime. The function newFunc will be called to create a new item when the pool is empty; the function expiredFunc will be called when an item in the pool has expired, and may be nil.
Click to show internal directories.
Click to hide internal directories.