pub struct HybridCleanupStrategy { /* private fields */ }Expand description
Default hybrid cleanup strategy that triggers cleanup based on both request count and elapsed time since the last cleanup.
This strategy maintains an internal counter of verification requests and tracks the time since the last cleanup. Cleanup is triggered when either threshold is exceeded.
Implementations§
Source§impl HybridCleanupStrategy
impl HybridCleanupStrategy
Sourcepub fn new(count_threshold: u32, time_threshold: Duration) -> Self
pub fn new(count_threshold: u32, time_threshold: Duration) -> Self
Creates a new hybrid cleanup strategy with the specified thresholds.
§Arguments
count_threshold- Number of verification requests before triggering cleanuptime_threshold- Maximum time duration between cleanups
§Example
use std::time::Duration;
use nonce_auth::nonce::cleanup::HybridCleanupStrategy;
// Cleanup every 100 requests or every 5 minutes
let strategy = HybridCleanupStrategy::new(100, Duration::from_secs(300));Sourcepub fn set_thresholds(&mut self, count_threshold: u32, time_threshold: Duration)
pub fn set_thresholds(&mut self, count_threshold: u32, time_threshold: Duration)
Updates the thresholds for this strategy.
This method allows modifying the cleanup triggers after creation.
Trait Implementations§
Source§impl CleanupStrategy for HybridCleanupStrategy
impl CleanupStrategy for HybridCleanupStrategy
Auto Trait Implementations§
impl !Freeze for HybridCleanupStrategy
impl RefUnwindSafe for HybridCleanupStrategy
impl Send for HybridCleanupStrategy
impl Sync for HybridCleanupStrategy
impl Unpin for HybridCleanupStrategy
impl UnwindSafe for HybridCleanupStrategy
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