pub struct MemoryRateLimitStore { /* private fields */ }Expand description
In-process sliding-window rate limiter.
Each unique key (e.g. principal public key bytes, or IP address bytes) gets an independent bucket. Buckets reset at the start of each window and entries are evicted lazily on the next write after they expire.
Implementations§
Trait Implementations§
Source§impl Default for MemoryRateLimitStore
impl Default for MemoryRateLimitStore
Source§impl RateLimitStore for MemoryRateLimitStore
impl RateLimitStore for MemoryRateLimitStore
fn check_and_record( &self, key: &[u8], max_per_window: u32, window_secs: u64, ) -> Result<bool, A1StorageError>
fn health_check(&self) -> Result<(), A1StorageError>
Auto Trait Implementations§
impl !Freeze for MemoryRateLimitStore
impl RefUnwindSafe for MemoryRateLimitStore
impl Send for MemoryRateLimitStore
impl Sync for MemoryRateLimitStore
impl Unpin for MemoryRateLimitStore
impl UnsafeUnpin for MemoryRateLimitStore
impl UnwindSafe for MemoryRateLimitStore
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