请求模块中的 DNS 缓存 - node.js

dns caching in request module - node.js

在我的项目中,我使用 'request' 模块向同一个 url 发出大量请求。由于某种原因,很多请求都转到 dns 服务器以解析 url 地址,而不是为此进行某种缓存。 'request' 模块中是否有某种内置机制来解决这个问题?或者任何其他解决方案?

谢谢!

这个问题有点老,所以你可能已经找到了答案,但我刚遇到这个问题并使用了 dnscache module to handle it. We had a high amount of IO (Node reading /etc/resolv.conf), and this module seemed to handle the problem. I couldn't find anything in Request's or Node's source to handle that problem, but did find this related issue

使用https://www.npmjs.com/package/lookup-dns-cache

遇到了同样的问题,所以创建了一个包来解决它。