pub async fn contact_payload(&self, contact_id: String) -> Result<ContactPayload, PuppetError> {
        debug!("contact_payload(contact_id = {})", contact_id);
        let cache = &*self.cache_contact_payload;
        if cache.lock().unwrap().contains(&contact_id) {
            Ok(cache.lock().unwrap().get(&contact_id).unwrap().clone())
        } else {
            match self.puppet_impl.contact_raw_payload(contact_id.clone()).await {
                Ok(payload) => {
                    cache.lock().unwrap().put(contact_id.clone(), payload.clone());
                    Ok(payload)
                }
                Err(e) => Err(e),
            }
        }
    }
/// Load a contact by id.
Load a contact by id.
Load a contact by id .
pub async fn contact_payload(&self, contact_id: String) -> Result<ContactPayload, PuppetError> {
        debug!("contact_payload(contact_id = {})", contact_id);
        let cache = &*self.cache_contact_payload;
        if cache.lock().unwrap().contains(&contact_id) {
            Ok(cache.lock().unwrap().get(&contact_id).unwrap().clone())
        } else {
            match self.puppet_impl.contact_raw_payload(contact_id.clone()).await {
                Ok(payload) => {
                    cache.lock().unwrap().put(contact_id.clone(), payload.clone());
                    Ok(payload)
                }
                Err(e) => Err(e),
            }
        }
    }
pub async fn contact_payload ( & self , contact_id : String ) -> Result < ContactPayload , PuppetError > { debug ! ( " " contact_id ) ; let cache = & * self . cache_contact_payload ; if cache . lock ( ) . unwrap ( ) . contains ( & contact_id ) { Ok ( cache . lock ( ) . unwrap ( ) . get ( & contact_id ) . unwrap ( ) . clone ( ) ) } else { match self . puppet_impl . contact_raw_payload ( contact_id . clone ( ) ) . await { Ok ( payload ) => { cache . lock ( ) . unwrap ( ) . put ( contact_id . clone ( ) , payload . clone ( ) ) ; Ok ( payload ) } Err ( e ) => Err ( e ) , } } }
Load a contact by id.
Load a contact by id .
&self
contact_id
String
&self
contact_id
String