-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
26 additions
and
2 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
pub mod redis; | ||
pub mod types; | ||
pub mod utils; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
use r2d2_redis::{r2d2, RedisConnectionManager}; | ||
use std::env; | ||
|
||
pub type RedisPool = r2d2::Pool<RedisConnectionManager>; | ||
|
||
pub fn initialize_redis_pool() -> RedisPool { | ||
let redis_url = env::var("REDIS_URL").expect("REDIS_URL must be set"); | ||
let manager = RedisConnectionManager::new(redis_url).unwrap(); | ||
r2d2::Pool::builder() | ||
.build(manager) | ||
.expect("Failed to create pool") | ||
} |