Return a one-line summary of cache performance.
(self)
| 196 | return self._misses |
| 197 | |
| 198 | def stats_summary(self) -> str: |
| 199 | """Return a one-line summary of cache performance.""" |
| 200 | total = self._hits + self._misses |
| 201 | if total == 0: |
| 202 | return "cache: no lookups" |
| 203 | rate = (self._hits / total) * 100 |
| 204 | return f"cache: {self._hits}/{total} hits ({rate:.0f}%)" |