Versions in this module Expand all Collapse all v0 v0.0.5 Oct 2, 2026 v0.0.4 Oct 1, 2026 v0.0.3 Sep 23, 2026 v0.0.2 Sep 21, 2026 v0.0.1 Sep 20, 2026 Changes in this version + var ErrArgument = errors.New("collection: incorrect timer argument") + var ErrClosed = errors.New("collection: timing wheel is closed") + type Bucket struct + Count int64 + Sum T + func (b *Bucket[T]) Add(v T) + func (b *Bucket[T]) Reset() + type BucketInterface interface + Add func(v T) + Reset func() + type Cache struct + func NewCache(expire time.Duration, opts ...CacheOption) (*Cache, error) + func (c *Cache) Close() + func (c *Cache) Del(key string) + func (c *Cache) Get(key string) (any, bool) + func (c *Cache) Set(key string, value any) + func (c *Cache) SetWithExpire(key string, value any, expire time.Duration) + func (c *Cache) Take(key string, fetch func() (any, error)) (any, error) + type CacheOption func(*Cache) + func WithLimit(limit int) CacheOption + type Execute func(key, value any) + type Numerical interface + type Queue struct + func NewQueue(size int) *Queue + func (q *Queue) Empty() bool + func (q *Queue) Put(element any) + func (q *Queue) Take() (any, bool) + type Ring struct + func NewRing(n int) *Ring + func (r *Ring) Add(v any) + func (r *Ring) Take() []any + type RollingWindow struct + func NewRollingWindow[T Numerical, B BucketInterface[T]](newBucket func() B, size int, interval time.Duration, ...) *RollingWindow[T, B] + func (rw *RollingWindow[T, B]) Add(v T) + func (rw *RollingWindow[T, B]) Reduce(fn func(b B)) + type RollingWindowOption func(*RollingWindow[T, B]) + func IgnoreCurrentBucket[T Numerical, B BucketInterface[T]]() RollingWindowOption[T, B] + type SafeMap struct + func NewSafeMap[K comparable, V any]() *SafeMap[K, V] + func (sm *SafeMap[K, V]) Del(key K) + func (sm *SafeMap[K, V]) Get(key K) (V, bool) + func (sm *SafeMap[K, V]) Len() int + func (sm *SafeMap[K, V]) Range(fn func(key K, value V) bool) + func (sm *SafeMap[K, V]) Set(key K, value V) + type Set map[T]struct + func NewSet[T comparable]() Set[T] + func (s Set[T]) Add(v T) + func (s Set[T]) Contains(v T) bool + func (s Set[T]) Len() int + func (s Set[T]) Remove(v T) + func (s Set[T]) Values() []T + type TimingWheel struct + func NewTimingWheel(interval time.Duration, numSlots int, execute Execute) (*TimingWheel, error) + func NewTimingWheelWithTicker(interval time.Duration, numSlots int, execute Execute, ticker timex.Ticker) (*TimingWheel, error) + func (tw *TimingWheel) Drain(fn func(key, value any)) error + func (tw *TimingWheel) MoveTimer(key any, delay time.Duration) error + func (tw *TimingWheel) RemoveTimer(key any) error + func (tw *TimingWheel) SetTimer(key, value any, delay time.Duration) error + func (tw *TimingWheel) Stop()