]> git.ipfire.org Git - thirdparty/dnspython.git/commitdiff
rename statistics class; add documentation 544/head
authorBob Halley <halley@dnspython.org>
Sun, 19 Jul 2020 14:26:13 +0000 (07:26 -0700)
committerBob Halley <halley@dnspython.org>
Sun, 19 Jul 2020 14:26:13 +0000 (07:26 -0700)
dns/resolver.py
doc/resolver-caching.rst

index 4d2b72b0358c69464cbca1d0d55b15d78e4076e4..ec163761bfffcce5c3a7f88c20f86f033dfdfd6a 100644 (file)
@@ -283,7 +283,7 @@ class Answer:
         del self.rrset[i]
 
 
-class CacheStats:
+class CacheStatistics:
     """Cache Statistics
     """
 
@@ -296,13 +296,13 @@ class CacheStats:
         self.misses = 0
 
     def clone(self):
-        return CacheStats(self.hits, self.misses)
+        return CacheStatistics(self.hits, self.misses)
 
 
 class CacheBase:
     def __init__(self):
         self.lock = _threading.Lock()
-        self.statistics = CacheStats()
+        self.statistics = CacheStatistics()
 
     def reset_statistics(self):
         """Reset all statistics to zero."""
index f39b8ad911469d435e502cef7a4f81f796491e22..c2150e81dd73c909661e195409d45d1e19ef9445 100644 (file)
@@ -11,7 +11,12 @@ the data, and will not return expired entries.
 
 Two thread-safe cache implementations are provided, a simple
 dictionary-based Cache, and an LRUCache which provides cache size
-control suitable for use in web crawlers.
+control suitable for use in web crawlers.  Both are subclasses of
+a common base class which provides basic statistics.  The LRUCache can
+also provide a hits count per cache entry.
+
+.. autoclass:: dns.resolver.CacheBase
+   :members:
 
 .. autoclass:: dns.resolver.Cache
    :members:
@@ -19,3 +24,5 @@ control suitable for use in web crawlers.
 .. autoclass:: dns.resolver.LRUCache
    :members:
 
+.. autoclass:: dns.resolver.CacheStatistics
+   :members: