Get cached documentation path if available.
(self, repo_url: str)
| 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.""" |
no test coverage detected