Skip to content

Commit

Permalink
golf
Browse files Browse the repository at this point in the history
  • Loading branch information
maxcountryman committed Sep 23, 2023
1 parent e19a245 commit 9f2c718
Showing 1 changed file with 5 additions and 13 deletions.
18 changes: 5 additions & 13 deletions src/redis_store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,21 +78,13 @@ impl SessionStore for RedisStore {
}

async fn load(&self, session_id: &SessionId) -> Result<Option<Session>, Self::Error> {
let record_value = self
Ok(self
.client
.get::<Option<Vec<u8>>, _>(session_id.to_string())
.await?;

let session = match record_value {
Some(record_value) => {
let session_record: SessionRecord = rmp_serde::from_slice(&record_value)?;
Some(session_record.into())
}

None => None,
};

Ok(session)
.await?
.map(|bs| rmp_serde::from_slice::<SessionRecord>(&bs))
.transpose()?
.map(Into::into))
}

async fn delete(&self, session_id: &SessionId) -> Result<(), Self::Error> {
Expand Down

0 comments on commit 9f2c718

Please sign in to comment.