Save current cache state to JSON file.
(self)
| 105 | return {} |
| 106 | |
| 107 | def _save_cache(self) -> None: |
| 108 | """Save current cache state to JSON file.""" |
| 109 | # Ensure cache directory exists |
| 110 | self.cache_file.parent.mkdir(parents=True, exist_ok=True) |
| 111 | |
| 112 | # Convert CacheEntry objects to JSON-serializable dict |
| 113 | data = {} |
| 114 | for file_path, entry in self.cache.items(): |
| 115 | data[file_path] = { |
| 116 | "modification_time": entry.modification_time, |
| 117 | "md5_hash": entry.md5_hash, |
| 118 | } |
| 119 | |
| 120 | with open(self.cache_file, "w") as f: |
| 121 | json.dump(data, f, indent=2) |
| 122 | |
| 123 | def _compute_md5(self, file_path: Path) -> str: |
| 124 | """ |
no test coverage detected