Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var SlidingWindowScript = `` /* 854-byte string literal not displayed */
View Source
var TokenBucketScript = `` /* 1740-byte string literal not displayed */
Functions ¶
func MillisToTime ¶
func TimeMillis ¶
Types ¶
type Bucket ¶
func NewTokenBucket ¶
NewTokenBucket returns a new rate limiter which uses the token bucket algorithm.
type RedigoStore ¶
func NewRedigoSWStore ¶
func NewRedigoSWStore(pool *redis.Pool) RedigoStore
func NewRedigoStore ¶
func NewRedigoStore(pool *redis.Pool) RedigoStore
func (*RedigoStore) Inc ¶
func (s *RedigoStore) Inc(key string, rate, windowSize, now int) (StoreResponse, error)
type SlidingWindow ¶
func NewSlidingWindow ¶
func NewSlidingWindow(identifier string, rate, windowSize int, store Store) SlidingWindow
NewSlidingWindow returns a new rate limiter which uses the token bucket algorithm.
func (*SlidingWindow) AllowWithStatus ¶
func (sw *SlidingWindow) AllowWithStatus(key string) (Status, error)
Click to show internal directories.
Click to hide internal directories.