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

Method save_cache_index

codewiki/src/fe/cache_manager.py:43–59  ·  view source on GitHub ↗

Save cache index to disk.

(self)

Source from the content-addressed store, hash-verified

41 print(f"Error loading cache index: {e}")
42
43 def save_cache_index(self):
44 """Save cache index to disk."""
45 index_file = self.cache_dir / "cache_index.json"
46 try:
47 data = {}
48 for key, entry in self.cache_index.items():
49 data[key] = {
50 'repo_url': entry.repo_url,
51 'repo_url_hash': entry.repo_url_hash,
52 'docs_path': entry.docs_path,
53 'created_at': entry.created_at.isoformat(),
54 'last_accessed': entry.last_accessed.isoformat()
55 }
56
57 file_manager.save_json(data, index_file)
58 except Exception as e:
59 print(f"Error saving cache index: {e}")
60
61 def get_repo_hash(self, repo_url: str) -> str:
62 """Generate hash for repository URL."""

Callers 4

get_cached_docsMethod · 0.95
add_to_cacheMethod · 0.95
remove_from_cacheMethod · 0.95
cleanup_expired_cacheMethod · 0.95

Calls 1

save_jsonMethod · 0.80

Tested by

no test coverage detected