Documentation ¶
Overview ¶
Package rate supply functionality about QPS for example rate limiting
Index ¶
Constants ¶
View Source
const (
DefaultRate = 2147483647
)
constant qps default rate
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Limiters ¶
Limiters manages all rate limiters. it is thread safe and singleton. it create new limiters and try to limit request. each limiter has a unique name.
func (*Limiters) DeleteRateLimiter ¶
DeleteRateLimiter delete rate limiter
func (*Limiters) TryAccept ¶
TryAccept try to accept a request. if limiter can not accept a request, it returns false name is the limiter name qps is not necessary if the limiter already exists
func (*Limiters) UpdateRateLimit ¶
UpdateRateLimit will update the old limiters
Click to show internal directories.
Click to hide internal directories.