Flush the cache. If *key* is not ``None``, only that item is flushed. Otherwise the entire cache is flushed. *key*, a ``(dns.name.Name, dns.rdatatype.RdataType, dns.rdataclass.RdataClass)`` tuple whose values are the query name, rdtype, and rdclass respectively.
(self, key: CacheKey | None = None)
| 483 | self.data[key] = value |
| 484 | |
| 485 | def flush(self, key: CacheKey | None = None) -> None: |
| 486 | """Flush the cache. |
| 487 | |
| 488 | If *key* is not ``None``, only that item is flushed. Otherwise the entire cache |
| 489 | is flushed. |
| 490 | |
| 491 | *key*, a ``(dns.name.Name, dns.rdatatype.RdataType, dns.rdataclass.RdataClass)`` |
| 492 | tuple whose values are the query name, rdtype, and rdclass respectively. |
| 493 | """ |
| 494 | |
| 495 | with self.lock: |
| 496 | if key is not None: |
| 497 | if key in self.data: |
| 498 | del self.data[key] |
| 499 | else: |
| 500 | self.data = {} |
| 501 | self.next_cleaning = time.time() + self.cleaning_interval |
| 502 | |
| 503 | |
| 504 | class LRUCacheNode: |