Skip to content

Commit

Permalink
Added comments for RateLimiterMemoryStoreConfig and RateLimiterMemory…
Browse files Browse the repository at this point in the history
…Store
  • Loading branch information
Jajanidze authored and aldas committed Nov 21, 2021
1 parent 3f09966 commit 902c553
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions middleware/rate_limiter.go
Expand Up @@ -153,9 +153,10 @@ func RateLimiterWithConfig(config RateLimiterConfig) echo.MiddlewareFunc {
type (
// RateLimiterMemoryStore is the built-in store implementation for RateLimiter
RateLimiterMemoryStore struct {
visitors map[string]*Visitor
mutex sync.Mutex
rate rate.Limit
visitors map[string]*Visitor
mutex sync.Mutex
rate rate.Limit //for more info check out Limiter docs - https://pkg.go.dev/golang.org/x/time/rate#Limit.

burst int
expiresIn time.Duration
lastCleanup time.Time
Expand Down Expand Up @@ -223,7 +224,7 @@ func NewRateLimiterMemoryStoreWithConfig(config RateLimiterMemoryStoreConfig) (s

// RateLimiterMemoryStoreConfig represents configuration for RateLimiterMemoryStore
type RateLimiterMemoryStoreConfig struct {
Rate rate.Limit // Rate of requests allowed to pass as req/s
Rate rate.Limit // Rate of requests allowed to pass as req/s. For more info check out Limiter docs - https://pkg.go.dev/golang.org/x/time/rate#Limit.
Burst int // Burst additionally allows a number of requests to pass when rate limit is reached
ExpiresIn time.Duration // ExpiresIn is the duration after that a rate limiter is cleaned up
}
Expand Down

0 comments on commit 902c553

Please sign in to comment.