pub async fn batch_put(&self, records: &[DbRecord]) {
        self.clean().await;

        debug!("BEGIN cache put batch");
        let mut guard = self.map.write().await;
        for record in records.iter() {
            if let DbRecord::Azks(azks_ref) = &record {
                let mut azks_guard = self.azks.write().await;
                *azks_guard = Some(DbRecord::Azks(azks_ref.clone()));
            } else {
                let key = record.get_full_binary_id();
                let item = CachedItem {
                    expiration: Instant::now() + self.item_lifetime,
                    data: record.clone(),
                };
                (*guard).insert(key, item);
            }
        }
        debug!("END cache put batch");
    }
/// Put a batch of items into the cache, utilizing a single write lock
Put a batch of items into the cache, utilizing a single write lock
Put a batch of items into the cache utilizing a single write lock
pub async fn batch_put(&self, records: &[DbRecord]) {
        self.clean().await;
        debug!("BEGIN cache put batch");
        let mut guard = self.map.write().await;
        for record in records.iter() {
            if let DbRecord::Azks(azks_ref) = &record {
                let mut azks_guard = self.azks.write().await;
                *azks_guard = Some(DbRecord::Azks(azks_ref.clone()));
            } else {
                let key = record.get_full_binary_id();
                let item = CachedItem {
                    expiration: Instant::now() + self.item_lifetime,
                    data: record.clone(),
                };
                (*guard).insert(key, item);
            }
        }
        debug!("END cache put batch");
    }
pub async fn batch_put ( & self , records : & [ DbRecord ] ) { self . clean ( ) . await ; debug ! ( " " ) ; let mut guard = self . map . write ( ) . await ; for record in records . iter ( ) { if let DbRecord :: Azks ( azks_ref ) = & record { let mut azks_guard = self . azks . write ( ) . await ; * azks_guard = Some ( DbRecord :: Azks ( azks_ref . clone ( ) ) ) ; } else { let key = record . get_full_binary_id ( ) ; let item = CachedItem { expiration : Instant :: now ( ) + self . item_lifetime , data : record . clone ( ) , } ; ( * guard ) . insert ( key , item ) ; } } debug ! ( " " ) ; }
Put a batch of items into the cache, utilizing a single write lock
Put a batch of items into the cache utilizing a single write lock
&self
records
&[DbRecord]
&self
records
&[DbRecord]