@@ -10,11 +10,7 @@ use axum::{
1010 routing:: get,
1111 Router ,
1212} ;
13- use bb8_redis:: {
14- bb8:: { self , Pool , PooledConnection } ,
15- redis:: AsyncCommands ,
16- RedisConnectionManager ,
17- } ;
13+ use redis:: AsyncCommands ;
1814use tracing_subscriber:: { layer:: SubscriberExt , util:: SubscriberInitExt } ;
1915
2016#[ tokio:: main]
@@ -28,8 +24,8 @@ async fn main() {
2824 . init ( ) ;
2925
3026 tracing:: debug!( "connecting to redis" ) ;
31- let manager = RedisConnectionManager :: new ( "redis://localhost" ) . unwrap ( ) ;
32- let pool = bb8:: Pool :: builder ( ) . build ( manager ) . await . unwrap ( ) ;
27+ let client = redis :: Client :: open ( "redis://localhost" ) . unwrap ( ) ;
28+ let pool = bb8:: Pool :: builder ( ) . build ( client ) . await . unwrap ( ) ;
3329
3430 {
3531 // ping the database before starting
@@ -56,7 +52,7 @@ async fn main() {
5652 axum:: serve ( listener, app) . await . unwrap ( ) ;
5753}
5854
59- type ConnectionPool = Pool < RedisConnectionManager > ;
55+ type ConnectionPool = bb8 :: Pool < redis :: Client > ;
6056
6157async fn using_connection_pool_extractor (
6258 State ( pool) : State < ConnectionPool > ,
@@ -68,7 +64,7 @@ async fn using_connection_pool_extractor(
6864
6965// we can also write a custom extractor that grabs a connection from the pool
7066// which setup is appropriate depends on your application
71- struct DatabaseConnection ( PooledConnection < ' static , RedisConnectionManager > ) ;
67+ struct DatabaseConnection ( bb8 :: PooledConnection < ' static , redis :: Client > ) ;
7268
7369impl < S > FromRequestParts < S > for DatabaseConnection
7470where
0 commit comments