Documentation ¶
Index ¶
- type Bucket
- type Cache
- type CacheOption
- type Execute
- type Queue
- type Ring
- type RollingWindow
- type RollingWindowOption
- type SafeMap
- type 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
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CacheOption ¶
type CacheOption func(cache *Cache)
func WithLimit ¶
func WithLimit(limit int) CacheOption
func WithName ¶
func WithName(name string) CacheOption
type RollingWindow ¶
type RollingWindow struct {
// contains filtered or unexported fields
}
RollingWindow defines a rolling window to calculate the events in buckets with time interval.
func NewRollingWindow ¶
func NewRollingWindow(size int, interval time.Duration, opts ...RollingWindowOption) *RollingWindow
NewRollingWindow returns a RollingWindow that with size buckets and time interval, use opts to customize the RollingWindow.
func (*RollingWindow) Add ¶
func (rw *RollingWindow) Add(v float64)
Add adds value to current bucket.
func (*RollingWindow) Reduce ¶
func (rw *RollingWindow) Reduce(fn func(b *Bucket))
Reduce runs fn on all buckets, ignore current bucket if ignoreCurrent was set.
type RollingWindowOption ¶
type RollingWindowOption func(rollingWindow *RollingWindow)
RollingWindowOption let callers customize the RollingWindow.
func IgnoreCurrentBucket ¶
func IgnoreCurrentBucket() RollingWindowOption
IgnoreCurrentBucket lets the Reduce call ignore current bucket.
type SafeMap ¶
type SafeMap struct {
// contains filtered or unexported fields
}
SafeMap provides a map alternative to avoid memory leak. This implementation is not needed until issue below fixed. https://github.com/golang/go/issues/20135
func NewSafeMap ¶
func NewSafeMap() *SafeMap
type Set ¶
type Set struct {
// contains filtered or unexported fields
}
Set is not thread-safe, for concurrent use, make sure to use it with synchronization.
func NewUnmanagedSet ¶
func NewUnmanagedSet() *Set
func (*Set) KeysUint64 ¶
type TimingWheel ¶
type TimingWheel struct {
// contains filtered or unexported fields
}
func NewTimingWheel ¶
func (*TimingWheel) Drain ¶
func (tw *TimingWheel) Drain(fn func(key, value interface{}))
func (*TimingWheel) MoveTimer ¶
func (tw *TimingWheel) MoveTimer(key interface{}, delay time.Duration)
func (*TimingWheel) RemoveTimer ¶
func (tw *TimingWheel) RemoveTimer(key interface{})
func (*TimingWheel) SetTimer ¶
func (tw *TimingWheel) SetTimer(key, value interface{}, delay time.Duration)
func (*TimingWheel) Stop ¶
func (tw *TimingWheel) Stop()