"""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)
