*cleaning_interval*, a ``float`` is the number of seconds between periodic cleanings.
(self, cleaning_interval: float = 300.0)
| 426 | """Simple thread-safe DNS answer cache.""" |
| 427 | |
| 428 | def __init__(self, cleaning_interval: float = 300.0) -> None: |
| 429 | """*cleaning_interval*, a ``float`` is the number of seconds between |
| 430 | periodic cleanings. |
| 431 | """ |
| 432 | |
| 433 | super().__init__() |
| 434 | self.data: Dict[CacheKey, Answer] = {} |
| 435 | self.cleaning_interval = cleaning_interval |
| 436 | self.next_cleaning: float = time.time() + self.cleaning_interval |
| 437 | |
| 438 | def _maybe_clean(self) -> None: |
| 439 | """Clean the cache if it's time to do so.""" |