pub struct DistributedRateLimiter { /* private fields */ }Expand description
分布式限流器
使用 DistributedBackend 实现跨实例共享的固定窗口限流。
适用于多实例部署场景。
Implementations§
Trait Implementations§
Source§impl RateLimiter for DistributedRateLimiter
impl RateLimiter for DistributedRateLimiter
fn acquire(&self, key: &str) -> Result<RateLimitResult, RateLimitError>
fn try_acquire(&self, key: &str) -> Result<RateLimitResult, RateLimitError>
fn reset(&self, key: &str) -> Result<(), RateLimitError>
Auto Trait Implementations§
impl !RefUnwindSafe for DistributedRateLimiter
impl !UnwindSafe for DistributedRateLimiter
impl Freeze for DistributedRateLimiter
impl Send for DistributedRateLimiter
impl Sync for DistributedRateLimiter
impl Unpin for DistributedRateLimiter
impl UnsafeUnpin for DistributedRateLimiter
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more