Replies: 4 comments 4 replies
-
It would be very similar to https://github.com/tokio-rs/axum/blob/main/examples/tokio-postgres/src/main.rs |
Beta Was this translation helpful? Give feedback.
-
When using Redis, I encountered a timeout issue of ten seconds for connection requests, as shown in the code below. How can I resolve this? I am looking forward to the answer. Thank you. // appstate Struct // use is_exist func // the result is only print is_exist start get_async_connection,not print end get_async_connection. `use redis::{AsyncCommands, ExistenceCheck, SetExpiry, SetOptions}; pub async fn is_exist(redis_client: &redis::Client, key: &str) -> bool {
}` |
Beta Was this translation helpful? Give feedback.
-
@drbh implemented this here: https://github.com/tokio-rs/axum/blob/main/examples/tokio-redis/src/main.rs |
Beta Was this translation helpful? Give feedback.
-
Using ConnectionManager, share use redis::aio::ConnectionManager;
pub struct AppState {
pub conn: ConnectionManager,
}
pub async fn foobar(State(state): State<Arc<AppState>>) {
let mut conn= state.conn.clone();
redis::cmd("SET").arg(&["key2", "bar"]).exec_async(&mut conn).await.unwrap();
pipe.query_async(&mut conn).await.unwrap();
} To use the |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Doesn't have to be massive just a jump start would be nice.
Beta Was this translation helpful? Give feedback.
All reactions