INNER CODE UNIT · Python
_show_cache_detail_table
KatrielMoses/voidaccess · voidaccess_cli/main.py:321
def _show_cache_detail_table() -> None:
"""Print a per-source TTL table under the main status table."""
from utils.enrichment_cache import DEFAULT_TTL
ttl_table = Table(title="Enrichment cache TTL defaults", show_lines=False)
ttl_table.add_column("Source", style="bold")
ttl_table.add_column("TTL (seconds)", justify="right")
ttl_table.add_column("TTL (human)")
def _human(seconds: int) -> str:
if seconds < 3600:
return f"{seconds // 60}m"
if seconds < 86400:
return f"{seconds // 3600}h"
return f"{seconds // 86400}d"
for source, ttl in sorted(DEFAULT_TTL.items()):
ttl_table.add_row(source, str(ttl), _human(ttl))