Versions in this module Expand all Collapse all v0 v0.2.1 Mar 21, 2019 v0.2.0 Mar 5, 2019 Changes in this version type MapLimitStore + func (m *MapLimitStore) Size() int v0.1.0 Feb 5, 2019 Changes in this version + type LimitStatus struct + CurrentRate float64 + IsLimited bool + LimitDuration *time.Duration + type LimitStore interface + Get func(key string, previousWindow, currentWindow time.Time) (prevValue int64, currValue int64, err error) + Inc func(key string, window time.Time) error + type MapLimitStore struct + func NewMapLimitStore(expirationTime time.Duration, flushInterval time.Duration) (m *MapLimitStore) + func (m *MapLimitStore) Get(key string, previousWindow, currentWindow time.Time) (prevValue int64, currValue int64, err error) + func (m *MapLimitStore) Inc(key string, window time.Time) error + type RateLimiter struct + func New(dataStore LimitStore, requestsLimit int64, windowSize time.Duration) *RateLimiter + func (r *RateLimiter) Check(key string) (limitStatus *LimitStatus, err error) + func (r *RateLimiter) Inc(key string) error