Documentation ¶
Index ¶
- type Limit
- func Parse(value string) (Limit, error)
- func PerDay(rate float64) Limit
- func PerDayBurst(rate float64, burst int) Limit
- func PerHour(rate float64) Limit
- func PerHourBurst(rate float64, burst int) Limit
- func PerMinute(rate float64) Limit
- func PerMinuteBurst(rate float64, burst int) Limit
- func PerSecond(rate float64) Limit
- func PerSecondBurst(rate float64, burst int) Limit
- type Limiter
- type LimiterOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Limit ¶
func Parse ¶
Parse is borrowed from https://github.com/ulule/limiter Copyright (c) 2015-2018 Ulule You can use the simplified format "<limit>-<period>"(burst is 1 by default) or "<limit>-<period>-<burst>", with the given periods:
* "S": second * "M": minute * "H": hour * "D": day
Examples for "<limit>-<period>" format:
* 5.5 reqs/second: "5.5-S" * 10 reqs/minute: "10-M" * 1000 reqs/hour: "1000-H" * 2000 reqs/day: "2000-D"
Examples:
* 0.0055 reqs/second with burst 20: "0.0055-S-20" https://github.com/go-redis/redis_rate/issues/63 * 10 reqs/minute with burst 200: "10-M-200" * 1000 reqs/hour with burst 500: "1000-H-500" * 2000 reqs/day with burst 1000: "2000-D-1000"
func PerDayBurst ¶
func PerHourBurst ¶
func PerMinuteBurst ¶
func PerSecondBurst ¶
type LimiterOption ¶
type LimiterOption func(Limiter)