Back to Explore

szmarczak/cacheable-lookup

GitHub
1 watchersOpen source

Last release:

Cacheable-lookup is a Node.js utility that wraps dns.lookup(…) to cache DNS results and respect DNS TTL values. It can reduce latency when making many HTTP requests, and it supports configurable caching, fallback behavior for ENOTFOUND and ENODATA, and cache installation on Node HTTP/HTTPS agents.

Project status

  • The last recorded upstream update was on 2024-01-29, and there have been no updates since. As of 2026-08-12, the project appears quiet or in maintenance mode rather than actively maintained.
  • Historical cadence is not clear, but the most recent activity is over two years ago, so there is no evidence of a current regular updates rhythm.

AI summary generated

AI-generated from public sources. May be inaccurate. Report

Recent updates

  • v7.0.0

    v7.0.0 migrates the package to a pure ESM implementation and drops older Node versions in favor of Node.js 14+. It also adds request statistics (query vs cache) to the CacheableLookup instance. The code changes largely match the release notes, but there are a couple of packaging/export-related changes that are not explicitly documented.

    BreakingFeatures
  • v6.1.0

    v6.1.0 introduces an entry.source field to indicate whether a DNS result was served from cache or obtained via a query. The change updates the returned entry shape and adds corresponding logic to label results, along with test and documentation updates.

    Features
  • v6.0.4

    Release v6.0.4 makes the DNS lookup behavior more tolerant on Windows by treating ENOENT as a non-fatal no-result case. Specifically, it updates the internal error handling to return an empty result array for ENOENT in addition to existing ENODATA and ENOTFOUND handling.

  • v6.0.3

    v6.0.3 is a small patch release that claims to fix a regression introduced in #43 (referenced as fixed in #48). The code diff shows a behavioral change in how DNS lookup errors are handled in CacheableLookup._lookup, plus a new test covering an error propagation case.

    Breaking
  • v6.0.2

    v6.0.2 updates the DNS resolution fallback behavior to query IPv4 and IPv6 separately. It also switches CI coverage reporting from Coveralls to Codecov and updates related docs/tests.

  • v6.0.1

    v6.0.1 makes a small TypeScript typing correction for the `CacheableLookup.lookup(...)` callback. The release notes only mention “Fix typings”, and the actual diff shows the callback error parameter type was adjusted to match Node.js behavior.

  • v6.0.0

    v6.0.0 adjusts how CacheableLookup performs fallback to dns.lookup when the DNS server returns ENOTFOUND/ENODATA or no entries. The release notes only mention making fallbackDuration=0 not disable fallback, but the code also introduces a new way to fully disable fallback via lookup: false and changes the typing accordingly.

    Features
  • v5.0.4

    v5.0.4 focuses on fixing a queue cleanup issue during fallback DNS lookups, ensuring the internal pending promise state is cleared. The code also tightens the supported Node.js runtime version via the package.json engines field.

    Breaking
  • v5.0.3

    v5.0.3 updates the CacheableLookup implementation to avoid running dns.lookup() as a background task, aligning with the release note about preventing memory leaks. The diff also shows a broader control flow change: the logic no longer races resolver against dns.lookup, and caching now happens synchronously within the main lookup path.

  • v5.0.2

    v5.0.2 changes the lookup resolution flow to retry the other DNS mechanism when the first result returns no entries. It also adds error handling around the race between the resolver-based path and dns.lookup-based path. The release notes only mention the retry behavior, not the additional pending-state cleanup.