Documentation
¶
Overview ¶
Package ratelimit provides rate limiting functionality using Redis
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type RateLimiter ¶
type RateLimiter interface { // Allow checks if a request is allowed for the given key // Returns true if allowed, false if rate limited, and the retry-after duration Allow(ctx context.Context, key string, limit int, window time.Duration) (bool, time.Duration, error) }
RateLimiter defines the interface for rate limiting
func NewRedisRateLimiter ¶
func NewRedisRateLimiter(client *redis.Client) RateLimiter
NewRedisRateLimiter creates a new Redis-based rate limiter
type RedisRateLimiter ¶
type RedisRateLimiter struct {
// contains filtered or unexported fields
}
RedisRateLimiter implements rate limiting using Redis sorted sets
Click to show internal directories.
Click to hide internal directories.