Documentation
¶
Overview ¶
NOTE: CODE BASE IS COPYED FROM https://github.com/eapache/queue/blob/main/v2/queue.go, modified to make it thread safe
Package queue provides a fast, ring-buffer queue based on the version suggested by Dariusz Górecki. Using this instead of other, simpler, queue implementations (slice+append or linked list) provides substantial memory and time benefits, and fewer GC pauses.
The queue implemented here is as fast as it is for an additional reason: it is *not* thread-safe.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NormalizeDuration ¶ added in v0.0.4
NormalizeDuration normalize duration
func UnsafeToBytes ¶
func UnsafeToString ¶
Types ¶
type Copool ¶
type Copool struct {
// contains filtered or unexported fields
}
type ObjectPool ¶
type ObjectPool[T any] struct { // contains filtered or unexported fields }
ObjectPool with Type
func NewObjectPool ¶
func NewObjectPool[T any](creator func() T) *ObjectPool[T]
func (*ObjectPool[T]) Get ¶
func (p *ObjectPool[T]) Get() T
func (*ObjectPool[T]) Put ¶
func (p *ObjectPool[T]) Put(x T)
type Queue ¶
type Queue[V any] struct { // contains filtered or unexported fields }
Queue represents a single instance of the queue data structure.
func (*Queue[V]) Get ¶ added in v0.1.1
Get returns the element at index i in the queue. If the index is invalid, the call will panic. This method accepts both positive and negative index values. Index 0 refers to the first element, and index -1 refers to the last.