dnspython  1.16.0
About: dnspython is a DNS toolkit (for Python 2.x) that supports almost all record types.
  Fossies Dox: dnspython-1.16.0.tar.gz  ("inofficial" and yet experimental doxygen-generated source code documentation)  

dns.resolver.LRUCache Class Reference
Inheritance diagram for dns.resolver.LRUCache:
[legend]
Collaboration diagram for dns.resolver.LRUCache:
[legend]

Public Member Functions

def __init__ (self, max_size=100000)
 
def set_max_size (self, max_size)
 
def get (self, key)
 
def put (self, key, value)
 
def flush (self, key=None)
 

Public Attributes

 data
 
 sentinel
 
 lock
 
 max_size
 

Detailed Description

Thread-safe, bounded, least-recently-used DNS answer cache.

This cache is better than the simple cache (above) if you're
running a web crawler or other process that does a lot of
resolutions.  The LRUCache has a maximum number of nodes, and when
it is full, the least-recently used node is removed to make space
for a new one.

Definition at line 401 of file resolver.py.

Constructor & Destructor Documentation

◆ __init__()

def dns.resolver.LRUCache.__init__ (   self,
  max_size = 100000 
)
*max_size*, an ``int``, is the maximum number of nodes to cache;
it must be greater than 0.

Definition at line 411 of file resolver.py.

Member Function Documentation

◆ flush()

def dns.resolver.LRUCache.flush (   self,
  key = None 
)
Flush the cache.

If *key* is not ``None``, only that item is flushed.  Otherwise
the entire cache is flushed.

*key*, a ``(dns.name.Name, int, int)`` tuple whose values are the
query name, rdtype, and rdclass respectively.

Definition at line 478 of file resolver.py.

References dns.rdtypes.IN.DHCID.DHCID.data, dns.edns.GenericOption.data, dns.rdata.GenericRdata.data, dns.resolver.Cache.data, dns.resolver.LRUCache.data, dns.resolver.LRUCache.get(), dns.entropy.EntropyPool.lock, dns.resolver.Cache.lock, dns.resolver.LRUCache.lock, and dns.resolver.LRUCache.sentinel.

◆ get()

def dns.resolver.LRUCache.get (   self,
  key 
)

◆ put()

def dns.resolver.LRUCache.put (   self,
  key,
  value 
)
Associate key and value in the cache.

*key*, a ``(dns.name.Name, int, int)`` tuple whose values are the
query name, rdtype, and rdclass respectively.

*value*, a ``dns.resolver.Answer``, the answer.

Definition at line 453 of file resolver.py.

References dns.rdtypes.IN.DHCID.DHCID.data, dns.edns.GenericOption.data, dns.rdata.GenericRdata.data, dns.resolver.Cache.data, dns.resolver.LRUCache.data, dns.resolver.LRUCache.get(), dns.entropy.EntropyPool.lock, dns.resolver.Cache.lock, dns.resolver.LRUCache.lock, dns.renderer.Renderer.max_size, dns.resolver.LRUCache.max_size, and dns.resolver.LRUCache.sentinel.

◆ set_max_size()

def dns.resolver.LRUCache.set_max_size (   self,
  max_size 
)

Definition at line 421 of file resolver.py.

Member Data Documentation

◆ data

dns.resolver.LRUCache.data

◆ lock

dns.resolver.LRUCache.lock

◆ max_size

dns.resolver.LRUCache.max_size

Definition at line 424 of file resolver.py.

Referenced by dns.resolver.LRUCache.put().

◆ sentinel

dns.resolver.LRUCache.sentinel

The documentation for this class was generated from the following file: