pub fn new(o_lifetime: Option<Duration>) -> Self {
        let lifetime = match o_lifetime {
            Some(life) if life > Duration::from_secs(1) => life,
            _ => Duration::from_millis(DEFAULT_ITEM_LIFETIME_MS),
        };
        Self {
            azks: Arc::new(tokio::sync::RwLock::new(None)),
            map: Arc::new(tokio::sync::RwLock::new(HashMap::new())),
            last_clean: Arc::new(tokio::sync::RwLock::new(Instant::now())),
            can_clean: Arc::new(tokio::sync::RwLock::new(true)),
            item_lifetime: lifetime,
            hit_count: Arc::new(tokio::sync::RwLock::new(0)),
        }
    }
/// Create a new timed cache instance. You can supply an optional item lifetime parameter
/// or take the default (30s)
Create a new timed cache instance. You can supply an optional item lifetime parameter
or take the default (30s)
Create a new timed cache instance . You can supply an optional item lifetime parameter or take the default ( 30s )
pub fn new(o_lifetime: Option<Duration>) -> Self {
        let lifetime = match o_lifetime {
            Some(life) if life > Duration::from_secs(1) => life,
            _ => Duration::from_millis(DEFAULT_ITEM_LIFETIME_MS),
        };
        Self {
            azks: Arc::new(tokio::sync::RwLock::new(None)),
            map: Arc::new(tokio::sync::RwLock::new(HashMap::new())),
            last_clean: Arc::new(tokio::sync::RwLock::new(Instant::now())),
            can_clean: Arc::new(tokio::sync::RwLock::new(true)),
            item_lifetime: lifetime,
            hit_count: Arc::new(tokio::sync::RwLock::new(0)),
        }
    }
pub fn new ( o_lifetime : Option < Duration > ) -> Self { let lifetime = match o_lifetime { Some ( life ) if life > Duration :: from_secs ( 1 ) => life , _ => Duration :: from_millis ( DEFAULT_ITEM_LIFETIME_MS ) , } ; Self { azks : Arc :: new ( tokio :: sync :: RwLock :: new ( None ) ) , map : Arc :: new ( tokio :: sync :: RwLock :: new ( HashMap :: new ( ) ) ) , last_clean : Arc :: new ( tokio :: sync :: RwLock :: new ( Instant :: now ( ) ) ) , can_clean : Arc :: new ( tokio :: sync :: RwLock :: new ( true ) ) , item_lifetime : lifetime , hit_count : Arc :: new ( tokio :: sync :: RwLock :: new ( 0 ) ) , } }
Create a new timed cache instance.
Create a new timed cache instance .
o_lifetime
Option<Duration>
o_lifetime
Option<Duration>