MCPcopy Create free account
hub / github.com/actix/examples / get_from_cache

Function get_from_cache

databases/redis/src/main.rs:6–18  ·  view source on GitHub ↗
(redis: web::Data<redis::Client>)

Source from the content-addressed store, hash-verified

4use serde::Deserialize;
5
6async fn get_from_cache(redis: web::Data<redis::Client>) -> actix_web::Result<impl Responder> {
7 let mut conn = redis
8 .get_connection_manager()
9 .await
10 .map_err(error::ErrorInternalServerError)?;
11
12 let res = redis::Cmd::mget(&["my_domain:one", "my_domain:two", "my_domain:three"])
13 .query_async::<Vec<String>>(&mut conn)
14 .await
15 .map_err(error::ErrorInternalServerError)?;
16
17 Ok(HttpResponse::Ok().json(res))
18}
19
20#[derive(Deserialize)]
21pub struct CacheInfo {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected