(self)
| 12543 | self._remove_entry(entry) |
| 12544 | |
| 12545 | def _evict_if_needed(self) -> None: |
| 12546 | if self.max_bytes <= 0: |
| 12547 | for entry in list(self._entries_by_id.values()): |
| 12548 | self._remove_entry(entry) |
| 12549 | return |
| 12550 | if self._size_bytes > self.max_bytes: |
| 12551 | self._evict_until(self.max_bytes) |
| 12552 | self._evict_until(int(self.max_bytes * 0.9)) |
| 12553 | |
| 12554 | def lookup(self, tokens: Sequence[int]) -> Optional[SequenceCache.Match]: |
| 12555 | if not tokens: |
no test coverage detected