From ca44df7c888fb32b9fcfd219fd2042561377ffa5 Mon Sep 17 00:00:00 2001 From: Jarred Sumner Date: Mon, 22 Jul 2024 03:57:18 -0700 Subject: [PATCH] Update fetch.md --- docs/api/fetch.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/docs/api/fetch.md b/docs/api/fetch.md index 32afdb96b76010..cd56832f242685 100644 --- a/docs/api/fetch.md +++ b/docs/api/fetch.md @@ -192,6 +192,12 @@ import { dns } from "bun"; dns.prefetch("bun.sh", 443); ``` +#### DNS caching + +By default, Bun caches and deduplicates DNS queries in-memory for up to 30 seconds. You can see the cache stats by calling `dns.getCacheStats()`: + +To learn more about DNS caching in Bun, see the [DNS caching](/docs/api/dns) documentation. + ### Preconnect to a host To preconnect to a host, you can use the `fetch.preconnect` API. This API is useful when you know you'll need to connect to a host soon and want to start the initial DNS lookup, TCP socket connection, and TLS handshake early.