Return the process-level cache instance. The disk cache is rooted at * /.pyspector_cache/ast* when *scan_path* is supplied on the first call. Subsequent calls return the same instance regardless of *scan_path*.
(scan_path: Optional[Path] = None)
| 450 | |
| 451 | |
| 452 | def get_cache(scan_path: Optional[Path] = None) -> IncrementalAstCache: |
| 453 | """ |
| 454 | Return the process-level cache instance. |
| 455 | |
| 456 | The disk cache is rooted at *<scan_path>/.pyspector_cache/ast* when |
| 457 | *scan_path* is supplied on the first call. Subsequent calls return the |
| 458 | same instance regardless of *scan_path*. |
| 459 | """ |
| 460 | global _instance |
| 461 | if _instance is None: |
| 462 | cache_dir: Optional[Path] = None |
| 463 | if scan_path: |
| 464 | base = scan_path if scan_path.is_dir() else scan_path.parent |
| 465 | cache_dir = base / ".pyspector_cache" / "ast" |
| 466 | _instance = IncrementalAstCache(cache_dir=cache_dir) |
| 467 | return _instance |
| 468 | |
| 469 | |
| 470 | def _reset_cache_singleton() -> None: |