kazu-yamamoto/dns

cache

Closed this issue · 3 comments

I would like to merge the concurrent-dns-cache library to the dns library.

Motivation:

  • I need a DNS cache for the domain-auth library. In my case, runSPF lookups the same theTXT record multiple times and wastes time.
  • concurrent-dns-cache can be used for IPv4 addresses only.
  • Even if concurrent-dns-cache is generalized for any records, it is hard to combine it with domain-auth

So, the dns library itself should have a cache. It should remember records for a while. It also possibly cache the ENDS0 related information.

It should be possible to disable any data cache. I query a local resolver on a loopback interface which has a sophisticated and efficient caching strategy. My own scans rarely do the same lookup twice, while looking up thousands of DNS records per second. My concern is that a cache in the stub resolver (Network.DNS) will negatively impact performance, and not add much value in my use-case.

Ideally, nobody should be using a far-away resolver where lookup latency is high enough to warrant a local cache? Why not have a local resolver? Of course some people will not do what I suggest, so they could perhaps use a cache, but this should be configurable.

It should be possible to disable any data cache.

Of course! It should be disabled by default.

Why not have a local resolver?

I don't want to setup a local resolver for my temporary research using the DNS lib.

Implemented.