async fn write_to_redis(&mut self, chat_id: ChatId, user_name: UserName) -> anyhow::Result<()> {
        if !self.is_known_user(chat_id, &user_name) {
            return Ok(());
        }

        let chains = &self
            .users
            .get(&chat_id)
            .expect("chat id data must exist on this step")
            .get(&user_name)
            .unwrap();

        let key = self.redis_key(chat_id, user_name);

        match self.redis_con {
            Some(ref mut redis_con) => {
                let raw = chains.serialize()?;
                redis_con.set(key, raw).await?;
            }
            None => {
                log::warn!("write_to_redis: can't save learn data, redis client is not set");
            }
        };

        Ok(())
    }
/// Writes new data per person to Redis
Writes new data per person to Redis
Writes new data per person to Redis
async fn write_to_redis(&mut self, chat_id: ChatId, user_name: UserName) -> anyhow::Result<()> {
        if !self.is_known_user(chat_id, &user_name) {
            return Ok(());
        }
        let chains = &self
            .users
            .get(&chat_id)
            .expect("chat id data must exist on this step")
            .get(&user_name)
            .unwrap();
        let key = self.redis_key(chat_id, user_name);
        match self.redis_con {
            Some(ref mut redis_con) => {
                let raw = chains.serialize()?;
                redis_con.set(key, raw).await?;
            }
            None => {
                log::warn!("write_to_redis: can't save learn data, redis client is not set");
            }
        };
        Ok(())
    }
async fn write_to_redis ( & mut self , chat_id : ChatId , user_name : UserName ) -> anyhow :: Result < ( ) > { if ! self . is_known_user ( chat_id , & user_name ) { return Ok ( ( ) ) ; } let chains = & self . users . get ( & chat_id ) . expect ( " " ) . get ( & user_name ) . unwrap ( ) ; let key = self . redis_key ( chat_id , user_name ) ; match self . redis_con { Some ( ref mut redis_con ) => { let raw = chains . serialize ( ) ? ; redis_con . set ( key , raw ) . await ? ; } None => { log :: warn ! ( " " ) ; } } ; Ok ( ( ) ) }
Writes new data per person to Redis
Writes new data per person to Redis
&mut self
chat_id
ChatId
user_name
UserName
&mut self
chat_id
ChatId
user_name
UserName