Skip to main content

RateLimitPolicy

Type Alias RateLimitPolicy 

Source
pub type RateLimitPolicy = Arc<dyn Fn(&str) -> Option<Limit> + Send + Sync>;
Expand description

Maps a rate-limit key to its budget — the hook that makes limits per-key. None means unlimited: the key is allowed without a D1 round trip and no row is written for it. Apps encode the plan in the key itself (plan:pro:ip:203.0.113.7, plan:pro:email:n@x.co) and match on the prefix; the ip:/email: keys of cratefield_core::rate_limit_keys slot in unchanged.

Aliased Type§

pub struct RateLimitPolicy { /* private fields */ }