초기 커밋

This commit is contained in:
2026-03-01 07:44:19 +09:00
commit 09359f30be
146 changed files with 6120 additions and 0 deletions

27
app/db/redis.py Normal file
View File

@@ -0,0 +1,27 @@
from __future__ import annotations
from redis.asyncio import Redis, from_url
from app.core.config import settings
redis_client: Redis | None = None
async def init_redis() -> None:
global redis_client
redis_client = from_url(
settings.REDIS_URL,
encoding="utf-8",
decode_responses=True,
)
async def close_redis() -> None:
global redis_client
if redis_client:
await redis_client.close()
def get_redis() -> Redis:
assert redis_client is not None, "Redis not initialized"
return redis_client