(cache_path: Union[str, Path])
| 220 | |
| 221 | @staticmethod |
| 222 | def visit(cache_path: Union[str, Path]): |
| 223 | # FIXME: Because read_lock was canceled when reading the cache, multiple processes may have read and write exceptions here |
| 224 | try: |
| 225 | cache_path = Path(cache_path) |
| 226 | meta_path = cache_path.with_suffix(".meta") |
| 227 | with meta_path.open("rb") as f: |
| 228 | d = pickle.load(f) |
| 229 | with meta_path.open("wb") as f: |
| 230 | try: |
| 231 | d["meta"]["last_visit"] = str(time.time()) |
| 232 | d["meta"]["visits"] = d["meta"]["visits"] + 1 |
| 233 | except KeyError as key_e: |
| 234 | raise KeyError("Unknown meta keyword") from key_e |
| 235 | pickle.dump(d, f, protocol=C.dump_protocol_version) |
| 236 | except Exception as e: |
| 237 | get_module_logger("CacheUtils").warning(f"visit {cache_path} cache error: {e}") |
| 238 | |
| 239 | @staticmethod |
| 240 | def acquire(lock, lock_name): |
no test coverage detected