| 67 | } |
| 68 | |
| 69 | async fn check_cache(&self, hash: &str) -> Result<Option<(String, String, i32)>> { |
| 70 | if let Some(redis_client) = &self.redis_client { |
| 71 | let mut conn = redis_client |
| 72 | .get_multiplexed_async_connection() |
| 73 | .await |
| 74 | .context("Failed to get Redis connection")?; |
| 75 | |
| 76 | let result: Option<String> = conn.get(hash).await?; |
| 77 | let deserialized: Option<(String, String, i32)> = match result { |
| 78 | Some(data) => serde_json::from_str(&data).ok(), |
| 79 | None => None, |
| 80 | }; |
| 81 | |
| 82 | Ok(deserialized) |
| 83 | } else { |
| 84 | Ok(None) |
| 85 | } |
| 86 | } |
| 87 | |
| 88 | async fn cache_result(&self, hash: &str, out: &str, err: &str, status: i32) -> Result<()> { |
| 89 | if let Some(redis_client) = &self.redis_client { |