import "github.com/andys/genringbuffer"Ringbuffer is a fixed length FIFO queue that drops new items when full and allows non-blocking polling for new items with optional timeout
type Ringbuffer[T any] chan Tfunc NewRingBuffer[T any](size int) Ringbuffer[T]NewRingbuffer creates a new ringbuffer with the given fixed number of items.
func (r Ringbuffer[T]) Cap() intCap returns the capacity of the ringbuffer.
func (r Ringbuffer[T]) Close()Close closes the ringbuffer.
func (r Ringbuffer[T]) Get() TGet gets an item from the ringbuffer, or blocks until one is available.
func (r Ringbuffer[T]) Len() intLen returns the number of items in the ringbuffer.
func (r Ringbuffer[T]) Offer(input T) boolOffer adds an item to the ringbuffer. If the buffer is full, it returns immediately. Returns true if added.
func (r Ringbuffer[T]) Poll(dur time.Duration) (obj T, res bool)Poll gets an item from the ringbuffer, or blocks until one is available, until dur duration passed. Returns true if an item was returned.
Generated by gomarkdoc