implemented rate limit and set up redis container
This commit is contained in:
Vendored
+23
@@ -0,0 +1,23 @@
|
||||
import redis.asyncio as redis
|
||||
|
||||
from src.models.configs_read.env import env_settings
|
||||
|
||||
|
||||
class RedisClient:
|
||||
def __init__(self) -> None:
|
||||
self.client = redis.Redis(
|
||||
host=env_settings.REDIS_HOST,
|
||||
port=env_settings.REDIS_PORT,
|
||||
password=env_settings.REDIS_PASSWORD,
|
||||
decode_responses=True,
|
||||
max_connections=10,
|
||||
)
|
||||
|
||||
def __getattr__(self, name):
|
||||
return getattr(self.client, name)
|
||||
|
||||
async def close(self) -> None:
|
||||
await self.client.aclose()
|
||||
|
||||
redis_client = RedisClient()
|
||||
|
||||
Reference in New Issue
Block a user