"""问数结果缓存主动失效(D-06 写侧钩子入口)。 事实表变更时 bump 表世代,fail-open(缓存失效失败不阻断业务写)。 """ from __future__ import annotations from app.service.cache_service import CacheService _svc: CacheService | None = None def _service() -> CacheService: global _svc if _svc is None: _svc = CacheService.auto() return _svc def bump_analyst_cache(*tables: str) -> None: if not tables: return _service().invalidate_tables(tables) def bump_analyst_cache_for_trade() -> None: bump_analyst_cache("core_trade") def bump_analyst_cache_for_risk_alert() -> None: bump_analyst_cache("risk_alert") def bump_analyst_cache_for_l3() -> None: bump_analyst_cache("customer_profile_l3")