diff --git a/src/middlewares/rate_limiter/redis_interactor.rs b/src/middlewares/rate_limiter/redis_interactor.rs index af3af54..d05e126 100644 --- a/src/middlewares/rate_limiter/redis_interactor.rs +++ b/src/middlewares/rate_limiter/redis_interactor.rs @@ -4,7 +4,7 @@ use redis::{aio::MultiplexedConnection, AsyncCommands, Client}; use super::{RateLimitInfo, Result}; -pub trait RedisInteractor{ +pub trait RateLimiterRedisInteractor{ async fn new(redis_url:String)->Result where Self:Sized; async fn get_data(&mut self,ip_addr:SocketAddr)-> Option ; async fn set_data(&mut self,ip_addr:SocketAddr,rate_limit_info:&RateLimitInfo); @@ -17,7 +17,7 @@ pub struct RedisRateLimiterDb{ } -impl RedisInteractor for RedisRateLimiterDb{ +impl RateLimiterRedisInteractor for RedisRateLimiterDb{ async fn new(redis_url:String)->Result { let client = Client::open(redis_url)?; let connection = client.get_multiplexed_async_connection().await?; @@ -31,7 +31,7 @@ impl RedisInteractor for RedisRateLimiterDb{ async fn set_data(&mut self, ip_addr: SocketAddr,rate_limit_info:&RateLimitInfo) { let key = ip_addr.to_string(); - self.connection.set::(key, rate_limit_info).await.unwrap(); // TODO, why ,,() ? + self.connection.set::(key, rate_limit_info).await.unwrap(); } }