MCPcopy Create free account
hub / github.com/Tong89/smartNode / _cache_is_fresh

Function _cache_is_fresh

backend/physics/tle_source.py:142–152  ·  view source on GitHub ↗

检查缓存文件是否在 TTL 期限内。

(group: str)

Source from the content-addressed store, hash-verified

140
141
142def _cache_is_fresh(group: str) -> bool:
143 """检查缓存文件是否在 TTL 期限内。"""
144 meta_file = _meta_path(group)
145 if not meta_file.exists():
146 return False
147 try:
148 meta = json.loads(meta_file.read_text(encoding="utf-8"))
149 age = time.time() - float(meta.get("fetched_at_unix", 0))
150 return age < _CACHE_MAX_AGE_SECONDS
151 except Exception:
152 return False
153
154
155def _parse_tle_text(text: str) -> List[TleEntry]:

Callers 2

fetch_groupFunction · 0.85
fetch_by_catnrFunction · 0.85

Calls 2

_meta_pathFunction · 0.85
getMethod · 0.45

Tested by

no test coverage detected