Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Limiter ¶
type Limiter struct {
// contains filtered or unexported fields
}
Limiter warps redis_rate.Limiter
func NewLimiter ¶
NewLimiter creates a new rate limiter backed by Redis
func (*Limiter) Allow ¶
func (l *Limiter) Allow(ctx context.Context, key string, limit int, window time.Duration) (*redis_rate.Result, error)
Allow checks if the request is allowed limit: max requests allowd window: time window Example: Allow("ip:127.0.0.1", 100, time.Minute) means 100 reqs per minute
Click to show internal directories.
Click to hide internal directories.