Skip to content

Commit

Permalink
fix: change naming
Browse files Browse the repository at this point in the history
  • Loading branch information
nikola-bozin-org committed Apr 23, 2024
1 parent ad1cc85 commit 7286d33
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/middlewares/rate_limiter/redis_interactor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Self> where Self:Sized;
async fn get_data(&mut self,ip_addr:SocketAddr)-> Option<RateLimitInfo> ;
async fn set_data(&mut self,ip_addr:SocketAddr,rate_limit_info:&RateLimitInfo);
Expand All @@ -17,7 +17,7 @@ pub struct RedisRateLimiterDb{
}


impl RedisInteractor for RedisRateLimiterDb{
impl RateLimiterRedisInteractor for RedisRateLimiterDb{
async fn new(redis_url:String)->Result<Self> {
let client = Client::open(redis_url)?;
let connection = client.get_multiplexed_async_connection().await?;
Expand All @@ -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::<String, &RateLimitInfo, ()>(key, rate_limit_info).await.unwrap(); // TODO, why ,,() ?
self.connection.set::<String, &RateLimitInfo, ()>(key, rate_limit_info).await.unwrap();

}
}
Expand Down

0 comments on commit 7286d33

Please sign in to comment.