-
Notifications
You must be signed in to change notification settings - Fork 160
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Introduce RateLimitOption to RateLimiterClient of rueidislimit…
…er (#681) RateLimitOption is currently a struct but in the future it can be converted to another type.
- Loading branch information
Showing
3 changed files
with
60 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package rueidislimiter | ||
|
||
import "time" | ||
|
||
type RateLimitOption struct { | ||
limit int64 | ||
window time.Duration | ||
} | ||
|
||
func WithCustomRateLimit(limit int, window time.Duration) RateLimitOption { | ||
return RateLimitOption{ | ||
limit: int64(limit), | ||
window: window, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters