pub async fn log_metrics(&self, level: log::Level) {
        let mut hit = self.hit_count.write().await;
        let hit_count = *hit;
        *hit = 0;
        let guard = self.map.read().await;
        let cache_size = (*guard).keys().len();
        let msg = format!(
            "Cache hit since last: {}, cached size: {} items",
            hit_count, cache_size
        );
        match level {
            log::Level::Trace => trace!("{}", msg),
            log::Level::Debug => debug!("{}", msg),
            log::Level::Info => info!("{}", msg),
            log::Level::Warn => warn!("{}", msg),
            _ => error!("{}", msg),
        }
    }
/// Log cache access metrics along with size information
Log cache access metrics along with size information
Log cache access metrics along with size information
pub async fn log_metrics(&self, level: log::Level) {
        let mut hit = self.hit_count.write().await;
        let hit_count = *hit;
        *hit = 0;
        let guard = self.map.read().await;
        let cache_size = (*guard).keys().len();
        let msg = format!(
            "Cache hit since last: {}, cached size: {} items",
            hit_count, cache_size
        );
        match level {
            log::Level::Trace => trace!("{}", msg),
            log::Level::Debug => debug!("{}", msg),
            log::Level::Info => info!("{}", msg),
            log::Level::Warn => warn!("{}", msg),
            _ => error!("{}", msg),
        }
    }
pub async fn log_metrics ( & self , level : log :: Level ) { let mut hit = self . hit_count . write ( ) . await ; let hit_count = * hit ; * hit = 0 ; let guard = self . map . read ( ) . await ; let cache_size = ( * guard ) . keys ( ) . len ( ) ; let msg = format ! ( " " hit_count cache_size ) ; match level { log :: Level :: Trace => trace ! ( " " msg ) , log :: Level :: Debug => debug ! ( " " msg ) , log :: Level :: Info => info ! ( " " msg ) , log :: Level :: Warn => warn ! ( " " msg ) , _ => error ! ( " " msg ) , } }
Log cache access metrics along with size information
Log cache access metrics along with size information
&self
level
log::Level
&self
level
log::Level