(
web::Json(info): web::Json<CacheInfo>,
redis: web::Data<redis::Client>,
)
| 25 | } |
| 26 | |
| 27 | async fn cache_stuff( |
| 28 | web::Json(info): web::Json<CacheInfo>, |
| 29 | redis: web::Data<redis::Client>, |
| 30 | ) -> actix_web::Result<impl Responder> { |
| 31 | let mut conn = redis |
| 32 | .get_connection_manager() |
| 33 | .await |
| 34 | .map_err(error::ErrorInternalServerError)?; |
| 35 | |
| 36 | let res = redis::Cmd::mset(&[ |
| 37 | ("my_domain:one", info.one), |
| 38 | ("my_domain:two", info.two), |
| 39 | ("my_domain:three", info.three), |
| 40 | ]) |
| 41 | .query_async::<String>(&mut conn) |
| 42 | .await |
| 43 | .map_err(error::ErrorInternalServerError)?; |
| 44 | |
| 45 | // not strictly necessary, but successful SET operations return "OK" |
| 46 | if res == "OK" { |
| 47 | Ok(HttpResponse::Ok().body("successfully cached values")) |
| 48 | } else { |
| 49 | Ok(HttpResponse::InternalServerError().finish()) |
| 50 | } |
| 51 | } |
| 52 | |
| 53 | async fn del_stuff(redis: web::Data<redis::Client>) -> actix_web::Result<impl Responder> { |
| 54 | let mut conn = redis |
nothing calls this directly
no outgoing calls
no test coverage detected