pub struct RateLimitCleanupConfig {
pub threshold: usize,
pub interval: Duration,
}Expand description
Configuration for automatic cleanup of expired rate limit entries.
Prevents memory exhaustion by periodically removing stale entries from the rate limiter when the entry count exceeds a threshold.
§Example
use std::time::Duration;
use wisegate_core::RateLimitCleanupConfig;
let config = RateLimitCleanupConfig {
threshold: 10_000,
interval: Duration::from_secs(60),
};
assert!(config.is_enabled());Fields§
§threshold: usizeNumber of entries before triggering cleanup (0 = disabled)
interval: DurationMinimum interval between cleanup operations
Implementations§
Source§impl RateLimitCleanupConfig
impl RateLimitCleanupConfig
Sourcepub fn is_enabled(&self) -> bool
pub fn is_enabled(&self) -> bool
Returns true if automatic cleanup is enabled.
Cleanup is enabled when threshold is greater than zero.
Trait Implementations§
Source§impl Clone for RateLimitCleanupConfig
impl Clone for RateLimitCleanupConfig
Source§fn clone(&self) -> RateLimitCleanupConfig
fn clone(&self) -> RateLimitCleanupConfig
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for RateLimitCleanupConfig
impl RefUnwindSafe for RateLimitCleanupConfig
impl Send for RateLimitCleanupConfig
impl Sync for RateLimitCleanupConfig
impl Unpin for RateLimitCleanupConfig
impl UnsafeUnpin for RateLimitCleanupConfig
impl UnwindSafe for RateLimitCleanupConfig
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