MCPcopy Create free account
hub / github.com/rthalley/dnspython / flush

Method flush

dns/resolver.py:485–501  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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
504class LRUCacheNode:

Callers 2

test_cache_flushMethod · 0.45
test_overrideMethod · 0.45

Calls 1

timeMethod · 0.80

Tested by 2

test_cache_flushMethod · 0.36
test_overrideMethod · 0.36