MCPcopy Create free account
hub / github.com/FastLED/FastLED / load_cache

Function load_cache

tests/test_metadata_cache.py:87–113  ·  view source on GitHub ↗

Load cached test metadata from build directory. Args: build_dir: Meson build directory (e.g., .build/meson-quick/) Returns: Cache dictionary with keys: hash, timestamp, metadata None if cache doesn't exist or is invalid

(build_dir: Path)

Source from the content-addressed store, hash-verified

85
86
87def load_cache(build_dir: Path) -> dict | None:
88 """
89 Load cached test metadata from build directory.
90
91 Args:
92 build_dir: Meson build directory (e.g., .build/meson-quick/)
93
94 Returns:
95 Cache dictionary with keys: hash, timestamp, metadata
96 None if cache doesn't exist or is invalid
97 """
98 cache_file = build_dir / CACHE_FILENAME
99 if not cache_file.exists():
100 return None
101
102 try:
103 with open(cache_file, "r", encoding="utf-8") as f:
104 cache = json.load(f)
105
106 # Validate cache structure
107 required_keys = ["hash", "timestamp", "metadata"]
108 if not all(key in cache for key in required_keys):
109 return None
110
111 return cache
112 except (json.JSONDecodeError, OSError):
113 return None
114
115
116def save_cache(build_dir: Path, tests_hash: str, metadata: str) -> None:

Callers 2

detect_changesFunction · 0.70
mainFunction · 0.70

Calls 2

allFunction · 0.85
loadMethod · 0.45

Tested by

no test coverage detected