Documentation ¶
Index ¶
Constants ¶
View Source
const DefaultPoolCapacity = 2048
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Pool ¶
type Pool[T comparable] struct { // contains filtered or unexported fields }
x.Pool is a specialized object pool implementation to replace sync.Pool. Unlike sync.Pool, x.Pool is backed by an MPMC queue, and objects in x.Pool will not be garbage collected for the lifetime of the pool, and its capacity is bounded. This is more useful if the objects in the pool should be long-lived.
func NewPool ¶
func NewPool[T comparable](capacity int) *Pool[T]
func (*Pool[T]) WithFactory ¶
Click to show internal directories.
Click to hide internal directories.