INNER CODE UNIT · Python
_get_enrichment_cache_stats_sync
KatrielMoses/voidaccess · voidaccess_cli/main.py:304
def _get_enrichment_cache_stats_sync() -> dict:
"""Synchronously fetch enrichment cache stats (cache errors → empty dict)."""
try:
from utils.async_utils import run_async
from utils.enrichment_cache import get_enrichment_cache
async def _fetch() -> dict:
cache = await get_enrichment_cache()
return await cache.stats()
return run_async(_fetch()) or {}
except Exception as exc:
logger_msg = exc # noqa: F841 — logged in caller if needed
return {"backend": "unavailable", "hits": 0, "misses": 0,
"hit_rate_pct": 0.0, "size": 0, "error": str(exc)[:120]}
def _show_cache_detail_table() -> None: