(self)
| 2663 | entry._cleanup_cb.cancel() |
| 2664 | |
| 2665 | def _maybe_cleanup(self): |
| 2666 | # Delete cache entries until the size of the cache is `max_size`. |
| 2667 | while len(self._entries) > self._max_size: |
| 2668 | old_query, old_entry = self._entries.popitem(last=False) |
| 2669 | self._clear_entry_callback(old_entry) |
| 2670 | |
| 2671 | # Let the connection know that the statement was removed |
| 2672 | # from the cache. |
| 2673 | self._on_remove(old_entry._statement) |
| 2674 | |
| 2675 | |
| 2676 | class _Callback(typing.NamedTuple): |
no test coverage detected