mirror of
https://github.com/labstack/echo.git
synced 2024-11-28 08:38:39 +02:00
Added comments for RateLimiterMemoryStoreConfig and RateLimiterMemoryStore
This commit is contained in:
parent
3f099663f1
commit
902c553552
@ -153,9 +153,10 @@ func RateLimiterWithConfig(config RateLimiterConfig) echo.MiddlewareFunc {
|
|||||||
type (
|
type (
|
||||||
// RateLimiterMemoryStore is the built-in store implementation for RateLimiter
|
// RateLimiterMemoryStore is the built-in store implementation for RateLimiter
|
||||||
RateLimiterMemoryStore struct {
|
RateLimiterMemoryStore struct {
|
||||||
visitors map[string]*Visitor
|
visitors map[string]*Visitor
|
||||||
mutex sync.Mutex
|
mutex sync.Mutex
|
||||||
rate rate.Limit
|
rate rate.Limit //for more info check out Limiter docs - https://pkg.go.dev/golang.org/x/time/rate#Limit.
|
||||||
|
|
||||||
burst int
|
burst int
|
||||||
expiresIn time.Duration
|
expiresIn time.Duration
|
||||||
lastCleanup time.Time
|
lastCleanup time.Time
|
||||||
@ -223,7 +224,7 @@ func NewRateLimiterMemoryStoreWithConfig(config RateLimiterMemoryStoreConfig) (s
|
|||||||
|
|
||||||
// RateLimiterMemoryStoreConfig represents configuration for RateLimiterMemoryStore
|
// RateLimiterMemoryStoreConfig represents configuration for RateLimiterMemoryStore
|
||||||
type RateLimiterMemoryStoreConfig struct {
|
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
|
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
|
ExpiresIn time.Duration // ExpiresIn is the duration after that a rate limiter is cleaned up
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user