(self, file_path: Path, file_hash: str)
| 404 | return self._cache_dir / f"{key}.json" |
| 405 | |
| 406 | def _disk_load(self, file_path: Path, file_hash: str) -> Optional[FileCacheEntry]: |
| 407 | p = self._disk_path(file_path) |
| 408 | if not p or not p.exists(): |
| 409 | return None |
| 410 | try: |
| 411 | entry = _deserialize_entry(p.read_text(encoding="utf-8")) |
| 412 | if entry.version == CACHE_VERSION and entry.file_hash == file_hash: |
| 413 | return entry |
| 414 | except Exception: |
| 415 | try: |
| 416 | p.unlink(missing_ok=True) |
| 417 | except OSError: |
| 418 | pass |
| 419 | return None |
| 420 | |
| 421 | def _disk_save(self, entry: FileCacheEntry) -> None: |
| 422 | p = self._disk_path(Path(entry.file_path)) |
no test coverage detected