Documentation ¶
Overview ¶
Package evictch contains an implementation of a buffered channel with the ability to evict old entries once the channel is filled entirely.
Note: the current implementation supports only 1 reader and 1 writer running concurrently.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Chan ¶
type Chan[T any] struct { // contains filtered or unexported fields }
Chan is an implementation of a buffered channel with automatic eviction of oldest entries.
func NewChan ¶
NewChan constructs a new buffered channel with eviction. A maximum of capacity elements will be retained. Note that capacity must be greater than 0, as the whole idea of such a channel is to allow write operations which will not wait for a reader to arrive.
func (*Chan[T]) Close ¶
func (ch *Chan[T]) Close()
Close closes the channel. This should be called after the writer is finished writing.