Documentation
¶
Overview ¶
Package ratelimit implements a Redis-backed, per-client, per-route-tier request rate limiter. Counters live in Redis (INCR + EXPIRE) rather than per-pod memory, so the limit is consistent across catalog-api's replicas instead of being N times looser depending on how many pods happen to be up.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Limiter ¶
type Limiter struct {
// contains filtered or unexported fields
}
Limiter enforces per-client request limits per tier, backed by a Redis connection pool.
func New ¶
New builds a Limiter using the given Redis pool and tier definitions. Callers should pass at least a "standard" and "cheap" tier; Allow falls back to "standard" for an unknown tier name.
Click to show internal directories.
Click to hide internal directories.