first commit
This commit is contained in:
commit
2da598738b
15 changed files with 3758 additions and 0 deletions
12
src/db/redis_helper.rs
Normal file
12
src/db/redis_helper.rs
Normal file
|
@ -0,0 +1,12 @@
|
|||
use redis::Client;
|
||||
use redis::aio::MultiplexedConnection;
|
||||
use std::env;
|
||||
|
||||
pub async fn connect() -> MultiplexedConnection {
|
||||
let url = env::var("REDIS_URL").expect("REDIS_URL is required");
|
||||
let client = Client::open(url).expect("Failed to create Redis client");
|
||||
client
|
||||
.get_multiplexed_tokio_connection()
|
||||
.await
|
||||
.expect("Failed to connect to Redis")
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue