MCPcopy
hub / github.com/Aider-AI/aider / _load_cache

Method _load_cache

aider/openrouter.py:96–112  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

94 self._update_cache()
95
96 def _load_cache(self) -> None:
97 if self._cache_loaded:
98 return
99 try:
100 self.cache_dir.mkdir(parents=True, exist_ok=True)
101 if self.cache_file.exists():
102 cache_age = time.time() - self.cache_file.stat().st_mtime
103 if cache_age < self.CACHE_TTL:
104 try:
105 self.content = json.loads(self.cache_file.read_text())
106 except json.JSONDecodeError:
107 self.content = None
108 except OSError:
109 # Cache directory might be unwritable; ignore.
110 pass
111
112 self._cache_loaded = True
113
114 def _update_cache(self) -> None:
115 try:

Callers 1

_ensure_contentMethod · 0.95

Calls 1

read_textMethod · 0.45

Tested by

no test coverage detected