mod lax_counter;
use std::time::Duration;
pub use lax_counter::*;
mod strict_counter;
use redis::aio::ConnectionManager;
pub use strict_counter::*;
mod counter_trait;
pub use counter_trait::*;
mod error;
pub use error::*;
use crate::RedisKey;
#[cfg(test)]
mod tests;
#[derive(Debug, Clone)]
pub struct CounterOptions {
pub prefix: RedisKey,
pub connection_manager: ConnectionManager,
pub allowed_lag: Duration,
}
impl CounterOptions {
pub fn new(prefix: RedisKey, connection_manager: ConnectionManager) -> Self {
Self {
prefix,
connection_manager,
allowed_lag: Duration::from_millis(20),
}
}
}