async fn load_entry(&self, key: &ImageKey) -> Result<Option<ImageEntry>, CacheError> {
        use std::convert::TryFrom;
        let bkey = Bytes::copy_from_slice(&key.as_bkey());

        // load the entire image entry from the database
        let images_fut = self.get_cf_async(Self::IMAGES_CF, bkey.clone());
        let meta_fut = self.get_cf_async(Self::META_CF, bkey);

        // wait for both futures and deserialize
        match tokio::try_join!(images_fut, meta_fut)? {
            // if there is data for both cfs, then integrate data and return
            (Some(data), Some(meta)) => {
                let mut entry = ImageEntry::try_from(meta).map_err(CacheError::Bincode)?;
                entry.bytes = data;
                Ok(Some(entry))
            }
            _ => Ok(None),
        }
    }
/// Loads an ImageEntry from the database at the specified key
///
/// Returns early if an error occurred on any DB operation
Loads an ImageEntry from the database at the specified key
Returns early if an error occurred on any DB operation
Loads an ImageEntry from the database at the specified key Returns early if an error occurred on any DB operation
async fn load_entry(&self, key: &ImageKey) -> Result<Option<ImageEntry>, CacheError> {
        use std::convert::TryFrom;
        let bkey = Bytes::copy_from_slice(&key.as_bkey());
        // load the entire image entry from the database
        let images_fut = self.get_cf_async(Self::IMAGES_CF, bkey.clone());
        let meta_fut = self.get_cf_async(Self::META_CF, bkey);
        // wait for both futures and deserialize
        match tokio::try_join!(images_fut, meta_fut)? {
            // if there is data for both cfs, then integrate data and return
            (Some(data), Some(meta)) => {
                let mut entry = ImageEntry::try_from(meta).map_err(CacheError::Bincode)?;
                entry.bytes = data;
                Ok(Some(entry))
            }
            _ => Ok(None),
        }
    }
async fn load_entry ( & self , key : & ImageKey ) -> Result < Option < ImageEntry > , CacheError > { use std :: convert :: TryFrom ; let bkey = Bytes :: copy_from_slice ( & key . as_bkey ( ) ) ; // load the entire image entry from the database let images_fut = self . get_cf_async ( Self :: IMAGES_CF , bkey . clone ( ) ) ; let meta_fut = self . get_cf_async ( Self :: META_CF , bkey ) ; // wait for both futures and deserialize match tokio :: try_join ! ( images_fut meta_fut ) ? { // if there is data for both cfs, then integrate data and return ( Some ( data ) , Some ( meta ) ) => { let mut entry = ImageEntry :: try_from ( meta ) . map_err ( CacheError :: Bincode ) ? ; entry . bytes = data ; Ok ( Some ( entry ) ) } _ => Ok ( None ) , } }
Loads an ImageEntry from the database at the specified key
Returns early if an error occurred on any DB operation
Loads an ImageEntry from the database at the specified key Returns early if an error occurred on any DB operation
&self
key
&ImageKey