Documentation
¶
Overview ¶
Package delayqueue describe an delayqueue implemention.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DelayQueue ¶
type DelayQueue[T any] interface { // Offer insert the element into the current DelayQueue, // if the expiration is blow the current min expiration, the item will // been fired first. Offer(elem T, expireation int64) // Poll starts an infinite loop, it will continually waits for an element to // been fired, and send the element to the output Chan. Poll(ctx context.Context) // Chan return the output chan, when the element is fired the element // will send to the channel. Chan() <-chan T // Size return the element count in the queue Size() int }
DelayQueue is an blocking queue of *Delay* elements, the element can only been taken when its delay has expired. The head of the queue is the element whose delay expired most recent in the queue.
func NewWithTimer ¶
func NewWithTimer[T any](size int, t Timer) DelayQueue[T]
NewWithTimer construct a DelayQueue with the initial size and Timer
Click to show internal directories.
Click to hide internal directories.