Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Aggregator ¶
type Aggregator[T any] struct { // contains filtered or unexported fields }
Aggregator is a synchronized map of items that can auto-expire once stale
func NewAggregator ¶
func NewAggregator[T any](bulkSize int, timeout time.Duration) *Aggregator[T]
NewAggregator is a helper to create instance of the aggregator
func (*Aggregator[T]) Close ¶
func (agg *Aggregator[T]) Close()
Close calls Purge, and then stops the goroutine that does ttl checking, for a clean shutdown. The cache is no longer cleaning up after the first call to Close, repeated calls are safe though.
func (*Aggregator[T]) Count ¶
func (agg *Aggregator[T]) Count() int
Count returns the number of items in the aggregator
func (*Aggregator[T]) SetBulkCallback ¶
func (agg *Aggregator[T]) SetBulkCallback(callback bulkCallback[T])
SetBulkCallback sets the callback on bulk creation
func (*Aggregator[T]) SetTimeoutCallback ¶
func (agg *Aggregator[T]) SetTimeoutCallback(callback timeoutCallback[T])
SetTimeoutCallback sets the callback on timeout
Click to show internal directories.
Click to hide internal directories.