Skip to content

Commit

Permalink
Update fetch.md
Browse files Browse the repository at this point in the history
  • Loading branch information
Jarred-Sumner committed Jul 22, 2024
1 parent 9daa7ea commit ca44df7
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions docs/api/fetch.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit ca44df7

Please sign in to comment.