Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type RateLimiter ¶
type RateLimiter struct {
// contains filtered or unexported fields
}
func New ¶
func New(rps int) *RateLimiter
New returns a new Limiter that allows events up to r requests per second.
func (*RateLimiter) Allow ¶
func (l *RateLimiter) Allow() bool
Allow returns true if the request should be allowed.
func (*RateLimiter) AllowN ¶
func (l *RateLimiter) AllowN(n int) bool
AllowN returns true if N requests should be allowed.
func (*RateLimiter) Limit ¶
func (l *RateLimiter) Limit() int
Limit returns the maximum overall event rate. Zero is returned when there is no limit specified.
Click to show internal directories.
Click to hide internal directories.