mirror of
https://github.com/sileht/bird-lg.git
synced 2024-12-22 12:34:42 +01:00
Use dnspython built-in cache to cache DNS queries for BGPmap
This is equivalent to the previous memcached cache, but much simpler to deploy (no additional service needed, everything is in process memory)
This commit is contained in:
parent
8f091cf27e
commit
108b2c4e44
|
@ -24,9 +24,11 @@ import socket
|
|||
import pickle
|
||||
import xml.parsers.expat
|
||||
|
||||
dns_cache = resolver.LRUCache(max_size=10000)
|
||||
resolv = resolver.Resolver()
|
||||
resolv.timeout = 0.5
|
||||
resolv.lifetime = 1
|
||||
resolv.cache = dns_cache
|
||||
|
||||
def resolve(n, q):
|
||||
return str(resolv.query(n,q)[0])
|
||||
|
|
Loading…
Reference in a new issue