- "backend/routers/review.py" - "backend/schemas.py" - "backend/redis_client.py" - "backend/main.py" - "backend/tests/test_review.py" GSD-Task: S04/T01
15 lines
446 B
Python
15 lines
446 B
Python
"""Async Redis client helper for Chrysopedia."""
|
|
|
|
import redis.asyncio as aioredis
|
|
|
|
from config import get_settings
|
|
|
|
|
|
async def get_redis() -> aioredis.Redis:
|
|
"""Return an async Redis client from the configured URL.
|
|
|
|
Callers should close the connection when done, or use it
|
|
as a short-lived client within a request handler.
|
|
"""
|
|
settings = get_settings()
|
|
return aioredis.from_url(settings.redis_url, decode_responses=True)
|