pub fn export_lru_keys(&self, db_name: &[u8]) -> Result<(), String> {
        info!("Exporting Lru Keys.  might take a while. Make sure instance remains up.");
        for i in 0..self.dbs.len() {
            let dbs = self.dbs.clone();
            let db_name_str = String::from_utf8_lossy(db_name).to_string();
            std::thread::spawn(move || {
                let db = &dbs[i];

                //let db =db.lock();
                let mut count = 0u64;
                if !db_name_str.is_empty() {
                    if db.name == db_name_str {
                        info!("Exporting keys for  db cache : {}", db_name_str);
                        count = match db.export_lru_keys() {
                            Ok(c) => c,
                            Err(e) => {
                                error!("Failed to export lru cache for db: {}. Error:{:?}", db_name_str, e);
                                0
                            }
                        }
                    }
                } else {
                    info!("Exporting keys for  db cache : {}", db_name_str);
                    count = match db.export_lru_keys() {
                        Ok(c) => c,
                        Err(e) => {
                            error!("Failed to export lru cache for db: {}. Error:{:?}", db_name_str, e);
                            0
                        }
                    }
                }

                info!("{} Keys export completed for db cache: {}", count, db_name_str);
            });
        };
        Ok(())
    }
///
/// Export all the Keys from LRU Cache to a file path configured in the cache mgr
Export all the Keys from LRU Cache to a file path configured in the cache mgr
Export all the Keys from LRU Cache to a file path configured in the cache mgr
pub fn export_lru_keys(&self, db_name: &[u8]) -> Result<(), String> {
        info!("Exporting Lru Keys.  might take a while. Make sure instance remains up.");
        for i in 0..self.dbs.len() {
            let dbs = self.dbs.clone();
            let db_name_str = String::from_utf8_lossy(db_name).to_string();
            std::thread::spawn(move || {
                let db = &dbs[i];
                //let db =db.lock();
                let mut count = 0u64;
                if !db_name_str.is_empty() {
                    if db.name == db_name_str {
                        info!("Exporting keys for  db cache : {}", db_name_str);
                        count = match db.export_lru_keys() {
                            Ok(c) => c,
                            Err(e) => {
                                error!("Failed to export lru cache for db: {}. Error:{:?}", db_name_str, e);
                                0
                            }
                        }
                    }
                } else {
                    info!("Exporting keys for  db cache : {}", db_name_str);
                    count = match db.export_lru_keys() {
                        Ok(c) => c,
                        Err(e) => {
                            error!("Failed to export lru cache for db: {}. Error:{:?}", db_name_str, e);
                            0
                        }
                    }
                }
                info!("{} Keys export completed for db cache: {}", count, db_name_str);
            });
        };
        Ok(())
    }
pub fn export_lru_keys ( & self , db_name : & [ u8 ] ) -> Result < ( ) , String > { info ! ( " " ) ; for i in 0 .. self . dbs . len ( ) { let dbs = self . dbs . clone ( ) ; let db_name_str = String :: from_utf8_lossy ( db_name ) . to_string ( ) ; std :: thread :: spawn ( move | | { let db = & dbs [ i ] ; //let db =db.lock(); let mut count = 0u64 ; if ! db_name_str . is_empty ( ) { if db . name == db_name_str { info ! ( " " db_name_str ) ; count = match db . export_lru_keys ( ) { Ok ( c ) => c , Err ( e ) => { error ! ( " " db_name_str e ) ; 0 } } } } else { info ! ( " " db_name_str ) ; count = match db . export_lru_keys ( ) { Ok ( c ) => c , Err ( e ) => { error ! ( " " db_name_str e ) ; 0 } } } info ! ( " " count db_name_str ) ; } ) ; } ; Ok ( ( ) ) }
Export all the Keys from LRU Cache to a file path configured in the cache mgr
Export all the Keys from LRU Cache to a file path configured in the cache mgr
&self
db_name
&[u8]