MCPcopy Create free account
hub / github.com/CommonstackAI/UncommonRoute / _save_cache

Method _save_cache

uncommon_route/benchmark.py:608–623  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

606 self._source_weights["seed"] = 0.8
607
608 def _save_cache(self) -> None:
609 try:
610 payload: dict[str, dict] = {}
611 for source_name, entries in self._sources.items():
612 payload[source_name] = {
613 model_id: asdict(entry)
614 for model_id, entry in entries.items()
615 }
616 _CACHE_PATH.parent.mkdir(parents=True, exist_ok=True, mode=0o700)
617 _CACHE_PATH.write_text(json.dumps({
618 "version": 1,
619 "last_refresh": self._last_refresh,
620 "sources": payload,
621 }, indent=2))
622 except Exception as exc:
623 logger.warning("Benchmark cache save failed: %s", exc)
624
625 def _load_cache(self) -> None:
626 if not _CACHE_PATH.exists():

Callers 1

refreshMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected