acupedia-api/app/cache/health.py

11 lines
501 B
Python

from __future__ import annotations
from fastapi import APIRouter, Depends
from .client import RedisRuntime
from .deps import get_redis_runtime
router = APIRouter(prefix="/system/cache", tags=["System"])
@router.get("/health")
async def cache_health(runtime: RedisRuntime = Depends(get_redis_runtime)) -> dict[str, object]:
healthy = await runtime.ping()
return {"enabled": runtime.settings.enabled, "available": runtime.available, "healthy": healthy, "fail_open": runtime.settings.fail_open}