Expand description
The throttle middleware.
ⓘ
let cache = CacheStore::from_config(&config)?;
router.group("/api", |r| {
r.get("/search", search);
})
.middleware(Throttle::per_minute(&cache, 60));Every response carries X-RateLimit-Limit and X-RateLimit-Remaining, so a
client can slow itself down before it is refused. A refused request gets 429
with Retry-After as well — the one header that actually tells a
well-behaved client what to do.
Structs§
- Throttle
- Limits how often one client may hit the routes it guards.