mirror of
https://github.com/sileht/bird-lg.git
synced 2024-12-21 20:14:43 +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
f41056a684
commit
3d90c14bfa
|
@ -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