MCPcopy
hub / github.com/HKUDS/DeepCode / _manage_cache_size

Method _manage_cache_size

tools/code_indexer.py:735–751  ·  view source on GitHub ↗

Manage cache size to stay within limits

(self)

Source from the content-addressed store, hash-verified

733 return str(file_path)
734
735 def _manage_cache_size(self):
736 """Manage cache size to stay within limits"""
737 if not self.enable_content_caching or not self.content_cache:
738 return
739
740 if len(self.content_cache) > self.max_cache_size:
741 # Remove oldest entries (simple FIFO strategy)
742 excess_count = len(self.content_cache) - self.max_cache_size + 10
743 keys_to_remove = list(self.content_cache.keys())[:excess_count]
744
745 for key in keys_to_remove:
746 del self.content_cache[key]
747
748 if self.verbose_output:
749 self.logger.info(
750 f"Cache cleaned: removed {excess_count} entries, {len(self.content_cache)} entries remaining"
751 )
752
753 async def analyze_file_content(self, file_path: Path) -> FileSummary:
754 """Analyze a single file and create summary with caching support"""

Callers 1

analyze_file_contentMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected