MCPcopy Create free account
hub / github.com/Graphify-Labs/graphify / _cache_entry_path

Function _cache_entry_path

graphify/cache.py:1475–1484  ·  view source on GitHub ↗

Prefer the hash shard within the requested semantic prompt namespace.

(root: Path, kind: str, digest: str, prompt_fp: str | None = None,
                      *, for_write: bool = False)

Source from the content-addressed store, hash-verified

1473
1474
1475def _cache_entry_path(root: Path, kind: str, digest: str, prompt_fp: str | None = None,
1476 *, for_write: bool = False) -> Path:
1477 """Prefer the hash shard within the requested semantic prompt namespace."""
1478 namespace = cache_dir(root, kind, prompt_fp)
1479 flat = namespace / f"{digest}.json"
1480 if kind.startswith("semantic"):
1481 shard = namespace / digest[:2] / flat.name
1482 if for_write or os.path.isfile(_os_long_path(shard)):
1483 return shard
1484 return flat
1485
1486
1487def load_cached(path: Path, root: Path = Path("."), kind: str = "ast",

Callers 3

load_cachedFunction · 0.85
save_cachedFunction · 0.85

Calls 1

cache_dirFunction · 0.85

Tested by

no test coverage detected