1
0
Fork 0
mirror of https://github.com/sileht/bird-lg.git synced 2024-11-21 14:34: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:
Baptiste Jonglez 2021-05-10 20:14:43 +02:00 committed by zorun
parent f41056a684
commit 3d90c14bfa

View file

@ -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])