Documentation
¶
Overview ¶
Package ratelimit bounds how often a caller may be served. It hands out one token bucket per key behind a hard cap on how many keys it will hold, so the registry itself cannot become an unbounded-memory attack surface. When the registry is full and cannot admit a new key, the caller is expected to fall back to a coarser, shared bucket rather than treat the key as unlimited or as permanently refused.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry hands out one token bucket per key, with a hard cap on how many keys it will hold.
func NewRegistry ¶
NewRegistry builds a Registry whose limiters each allow limit tokens per second with the given burst, holding at most maxKeys keys at once.