Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement DNS querying cache management API #57641

Open
Ethan-Arrowood opened this issue Mar 26, 2025 · 1 comment
Open

Implement DNS querying cache management API #57641

Ethan-Arrowood opened this issue Mar 26, 2025 · 1 comment
Assignees
Labels
cares Issues and PRs related to the c-ares dependency or the cares_wrap binding. dns Issues and PRs related to the dns subsystem. feature request Issues that request new features to be added to Node.js.

Comments

@Ethan-Arrowood
Copy link
Contributor

What is the problem this feature will solve?

Follow up to #57640 , we should create an API that allows users to specify the DNS querying cache TTL.

With the addition of this API, we should restore the default behavior to match the (sensible) defaults of c-ares (i.e. remove the qcache_max_ttl=0`).

I will contribute this in the coming days.

What is the feature you are proposing to solve the problem?

API I have in my head is to add a ttl option to https://nodejs.org/api/dns.html#resolveroptions and to all of the shortcuts too i.e. https://nodejs.org/api/dns.html#dnsresolvehostname-rrtype-callback

Something like dns.resolve('...', { ttl: 100 }, () => {}); or new dns.Resolver({ ttl: 100 });

What alternatives have you considered?

No response

@Ethan-Arrowood Ethan-Arrowood added the feature request Issues that request new features to be added to Node.js. label Mar 26, 2025
@github-project-automation github-project-automation bot moved this to Awaiting Triage in Node.js feature requests Mar 26, 2025
@Ethan-Arrowood Ethan-Arrowood self-assigned this Mar 26, 2025
@Ethan-Arrowood Ethan-Arrowood added dns Issues and PRs related to the dns subsystem. cares Issues and PRs related to the c-ares dependency or the cares_wrap binding. labels Mar 26, 2025
@ronag
Copy link
Member

ronag commented Mar 28, 2025

Should we somehow automatically clear the cache if we detect a connection error to a cached IP? Does that make sense?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cares Issues and PRs related to the c-ares dependency or the cares_wrap binding. dns Issues and PRs related to the dns subsystem. feature request Issues that request new features to be added to Node.js.
Projects
Status: Awaiting Triage
Development

No branches or pull requests

2 participants