pub async fn print_hashmap_distribution(&self) {
        println!("Cache distribution of length of entries (in bytes):");
        println!("---------------------");

        let cache = self.cache.read().await;

        let mut distribution: HashMap<usize, usize> = HashMap::new();

        for (_, val) in cache.iter() {
            if let Ok(len) = bincode::serialize(val).map(|item| item.len()) {
                let counter = distribution.entry(len).or_insert(0);
                *counter += 1;
            }
        }

        let mut sorted_keys: Vec<usize> = distribution.keys().cloned().collect();
        sorted_keys.sort_unstable();

        for key in sorted_keys {
            println!("{}: {}", key, distribution[&key]);
        }
        println!("---------------------");
        println!("Cache number of elements: {}", cache.len());
        println!("---------------------");
    }
/// Prints the distribution of the lengths of entries in a db
Prints the distribution of the lengths of entries in a db
Prints the distribution of the lengths of entries in a db
pub async fn print_hashmap_distribution(&self) {
        println!("Cache distribution of length of entries (in bytes):");
        println!("---------------------");
        let cache = self.cache.read().await;
        let mut distribution: HashMap<usize, usize> = HashMap::new();
        for (_, val) in cache.iter() {
            if let Ok(len) = bincode::serialize(val).map(|item| item.len()) {
                let counter = distribution.entry(len).or_insert(0);
                *counter += 1;
            }
        }
        let mut sorted_keys: Vec<usize> = distribution.keys().cloned().collect();
        sorted_keys.sort_unstable();
        for key in sorted_keys {
            println!("{}: {}", key, distribution[&key]);
        }
        println!("---------------------");
        println!("Cache number of elements: {}", cache.len());
        println!("---------------------");
    }
pub async fn print_hashmap_distribution ( & self ) { println ! ( " " ) ; println ! ( " " ) ; let cache = self . cache . read ( ) . await ; let mut distribution : HashMap < usize , usize > = HashMap :: new ( ) ; for ( _ , val ) in cache . iter ( ) { if let Ok ( len ) = bincode :: serialize ( val ) . map ( | item | item . len ( ) ) { let counter = distribution . entry ( len ) . or_insert ( 0 ) ; * counter += 1 ; } } let mut sorted_keys : Vec < usize > = distribution . keys ( ) . cloned ( ) . collect ( ) ; sorted_keys . sort_unstable ( ) ; for key in sorted_keys { println ! ( " " key distribution [ key ] ) ; } println ! ( " " ) ; println ! ( " " cache len ( ) ) ; println ! ( " " ) ; }
Prints the distribution of the lengths of entries in a db
Prints the distribution of the lengths of entries in a db
&self
&self