2.1.2 • Published 3 years ago

@zeit/dns-cached-resolve v2.1.2

Weekly downloads
19,040
License
Apache-2.0
Repository
github
Last release
3 years ago

Caching DNS Resolver

CircleCI

Cache DNS A and AAAA record resolutions.

Example

index.js

async function run() {
  console.log('resolve("zeit.co")');
  for (let i = 0; i < 10; i++) {
    console.time('resolve');
    console.log('IP: ', await dnsResolve('zeit.co'));
    console.timeEnd('resolve');
  }
}
run().catch(console.error);
% node index.js
resolve("zeit.co")
IP:  54.153.55.116
resolve: 569.156ms
IP:  54.153.55.116
resolve: 0.256ms
IP:  54.153.55.116
resolve: 0.061ms
IP:  54.153.55.116
resolve: 0.036ms