Skip to content

Commit 902c553

Browse files
Jajanidzealdas
authored andcommitted
Added comments for RateLimiterMemoryStoreConfig and RateLimiterMemoryStore
1 parent 3f09966 commit 902c553

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

middleware/rate_limiter.go

+5-4
Original file line numberDiff line numberDiff line change
@@ -153,9 +153,10 @@ func RateLimiterWithConfig(config RateLimiterConfig) echo.MiddlewareFunc {
153153
type (
154154
// RateLimiterMemoryStore is the built-in store implementation for RateLimiter
155155
RateLimiterMemoryStore struct {
156-
visitors map[string]*Visitor
157-
mutex sync.Mutex
158-
rate rate.Limit
156+
visitors map[string]*Visitor
157+
mutex sync.Mutex
158+
rate rate.Limit //for more info check out Limiter docs - https://pkg.go.dev/golang.org/x/time/rate#Limit.
159+
159160
burst int
160161
expiresIn time.Duration
161162
lastCleanup time.Time
@@ -223,7 +224,7 @@ func NewRateLimiterMemoryStoreWithConfig(config RateLimiterMemoryStoreConfig) (s
223224

224225
// RateLimiterMemoryStoreConfig represents configuration for RateLimiterMemoryStore
225226
type RateLimiterMemoryStoreConfig struct {
226-
Rate rate.Limit // Rate of requests allowed to pass as req/s
227+
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.
227228
Burst int // Burst additionally allows a number of requests to pass when rate limit is reached
228229
ExpiresIn time.Duration // ExpiresIn is the duration after that a rate limiter is cleaned up
229230
}

0 commit comments

Comments
 (0)