Versions in this module Expand all Collapse all v1 v1.1.4 Jan 13, 2021 v1.1.3 Jan 13, 2021 Changes in this version + type Bucket struct + Count int64 + Sum float64 + type Cache struct + func NewCache(expire time.Duration, opts ...CacheOption) (*Cache, error) + func (c *Cache) Del(key string) + func (c *Cache) Get(key string) (interface{}, bool) + func (c *Cache) Set(key string, value interface{}) + func (c *Cache) Take(key string, fetch func() (interface{}, error)) (interface{}, error) + type CacheOption func(cache *Cache) + func WithLimit(limit int) CacheOption + func WithName(name string) CacheOption + type Execute func(key, value interface{}) + type Queue struct + func NewQueue(size int) *Queue + func (q *Queue) Empty() bool + func (q *Queue) Put(element interface{}) + func (q *Queue) Take() (interface{}, bool) + type Ring struct + func NewRing(n int) *Ring + func (r *Ring) Add(v interface{}) + func (r *Ring) Take() []interface{} + type RollingWindow struct + func NewRollingWindow(size int, interval time.Duration, opts ...RollingWindowOption) *RollingWindow + func (rw *RollingWindow) Add(v float64) + func (rw *RollingWindow) Reduce(fn func(b *Bucket)) + type RollingWindowOption func(rollingWindow *RollingWindow) + func IgnoreCurrentBucket() RollingWindowOption + type SafeMap struct + func NewSafeMap() *SafeMap + func (m *SafeMap) Del(key interface{}) + func (m *SafeMap) Get(key interface{}) (interface{}, bool) + func (m *SafeMap) Set(key, value interface{}) + func (m *SafeMap) Size() int + type Set struct + func NewSet() *Set + func NewUnmanagedSet() *Set + func (s *Set) Add(i ...interface{}) + func (s *Set) AddInt(ii ...int) + func (s *Set) AddInt64(ii ...int64) + func (s *Set) AddStr(ss ...string) + func (s *Set) AddUint(ii ...uint) + func (s *Set) AddUint64(ii ...uint64) + func (s *Set) Contains(i interface{}) bool + func (s *Set) Count() int + func (s *Set) Keys() []interface{} + func (s *Set) KeysInt() []int + func (s *Set) KeysInt64() []int64 + func (s *Set) KeysStr() []string + func (s *Set) KeysUint() []uint + func (s *Set) KeysUint64() []uint64 + func (s *Set) Remove(i interface{}) + type TimingWheel struct + func NewTimingWheel(interval time.Duration, numSlots int, execute Execute) (*TimingWheel, error) + func (tw *TimingWheel) Drain(fn func(key, value interface{})) + func (tw *TimingWheel) MoveTimer(key interface{}, delay time.Duration) + func (tw *TimingWheel) RemoveTimer(key interface{}) + func (tw *TimingWheel) SetTimer(key, value interface{}, delay time.Duration) + func (tw *TimingWheel) Stop()