Skip to content

Commit

Permalink
docs: add rate.Limiter to the input of RateLimiter (#348)
Browse files Browse the repository at this point in the history
  • Loading branch information
arminshfatemi committed Jul 26, 2024
1 parent f039a5d commit b71b75d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions website/docs/middleware/rate-limiter.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ To add a rate limit to your application simply add the `RateLimiter` middleware.
The example below will limit the application to 20 requests/sec using the default in-memory store:

```go
e.Use(middleware.RateLimiter(middleware.NewRateLimiterMemoryStore(20)))
e.Use(middleware.RateLimiter(middleware.NewRateLimiterMemoryStore(rate.Limit(20))))
```

:::info
Expand All @@ -30,7 +30,7 @@ If the provided rate is a float number, Burst will be treated as the rounded dow
config := middleware.RateLimiterConfig{
Skipper: middleware.DefaultSkipper,
Store: middleware.NewRateLimiterMemoryStoreWithConfig(
middleware.RateLimiterMemoryStoreConfig{Rate: 10, Burst: 30, ExpiresIn: 3 * time.Minute},
middleware.RateLimiterMemoryStoreConfig{Rate: rate.Limit(10), Burst: 30, ExpiresIn: 3 * time.Minute},
),
IdentifierExtractor: func(ctx echo.Context) (string, error) {
id := ctx.RealIP()
Expand Down

0 comments on commit b71b75d

Please sign in to comment.