Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type RateLimiter ¶
type RateLimiter struct {
// contains filtered or unexported fields
}
RateLimiter implements an in-memory rate limiter using sliding window algorithm
func (*RateLimiter) Allow ¶
Allow checks if a request is allowed based on the rate limit Returns true if the request is allowed, false if rate limit exceeded
func (*RateLimiter) GetCount ¶
func (rl *RateLimiter) GetCount(key string, windowDuration time.Duration) int
GetCount returns the current count for a key within the window
func (*RateLimiter) Reset ¶
func (rl *RateLimiter) Reset(key string)
Reset removes all tracking data for a specific key
Click to show internal directories.
Click to hide internal directories.