mirror of
https://github.com/lorsanstand/Aether.git
synced 2026-09-18 14:18:20 +03:00
Create authorization system
This commit is contained in:
Executable
+22
@@ -0,0 +1,22 @@
|
||||
from redis.asyncio import Redis, from_url
|
||||
|
||||
from app.config import settings
|
||||
|
||||
redis_client: Redis = None
|
||||
|
||||
async def init_redis() -> None:
|
||||
global redis_client
|
||||
redis_client = await from_url(
|
||||
settings.REDIS_URL,
|
||||
encoding="utf-8",
|
||||
decode_responses=True
|
||||
)
|
||||
|
||||
|
||||
async def close_redis() -> None:
|
||||
if redis_client:
|
||||
await redis_client.close()
|
||||
|
||||
|
||||
async def get_redis() -> Redis:
|
||||
return redis_client
|
||||
Reference in New Issue
Block a user