Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { // Identifier a distinguish between different limiters Identifier string // TickerInterval duration of report/fetch increment to/from redis TickerInterval time.Duration // Limit the expected rate Limit struct { // Upper the expected maximum speed Upper uint32 // Lower used when lose redis Lower uint16 } // Log setup logger, if enable and no logger set, zap.NewProduction() will used. Log struct { Enable bool Logger *zap.Logger } }
Config how setup Limiter
type Limiter ¶
type Limiter interface { // Close the limiter Close() error // UpdateRate dynamic update rate, err will returned if parameters set zero UpdateRate(limitUpper uint32, limitLower uint16) error // Allow whether event can happen at time now Allow() }
Limiter a distributed speed limiter
Click to show internal directories.
Click to hide internal directories.