MCPcopy Index your code
hub / github.com/FSoft-AI4Code/CodeWiki / get_cached_docs

Method get_cached_docs

codewiki/src/fe/cache_manager.py:65–82  ·  view source on GitHub ↗

Get cached documentation path if available.

(self, repo_url: str)

Source from the content-addressed store, hash-verified

63 return hashlib.sha256(repo_url.encode()).hexdigest()[:16]
64
65 def get_cached_docs(self, repo_url: str) -> Optional[str]:
66 """Get cached documentation path if available."""
67 repo_hash = self.get_repo_hash(repo_url)
68
69 if repo_hash in self.cache_index:
70 entry = self.cache_index[repo_hash]
71
72 # Check if cache is still valid
73 if datetime.now() - entry.created_at < timedelta(days=self.cache_expiry_days):
74 # Update last accessed
75 entry.last_accessed = datetime.now()
76 self.save_cache_index()
77 return entry.docs_path
78 else:
79 # Cache expired, remove it
80 self.remove_from_cache(repo_url)
81
82 return None
83
84 def add_to_cache(self, repo_url: str, docs_path: str):
85 """Add documentation to cache."""

Callers 3

_process_jobMethod · 0.80
index_postMethod · 0.80
serve_generated_docsMethod · 0.80

Calls 3

get_repo_hashMethod · 0.95
save_cache_indexMethod · 0.95
remove_from_cacheMethod · 0.95

Tested by

no test coverage detected