basic/basic.rs
1use std::str::FromStr;
2
3use redi_rs::RedisPool;
4
5#[tokio::main]
6async fn main() -> Result<(), Box<dyn std::error::Error>> {
7 let mut pool: RedisPool = RedisPool::from_str("localhost:6379").unwrap();
8 // Or from SocketAddr
9 // let mut pool = RedisPool::from(SocketAddr::from(([127, 0, 0, 1], 6379)));
10
11 let _ = pool.max_connections(10).establish_pool().await?;
12
13 pool.send_command("SET foo bar").await?;
14
15 Ok(())
16}