[PR #1747] [MERGED] Relax mut requirements for resolver.clear_cache() and add cache flushing example #2560

Closed
opened 2026-03-16 10:11:59 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/hickory-dns/hickory-dns/pull/1747
Author: @dns2utf8
Created: 7/27/2022
Status: Merged
Merged: 8/1/2022
Merged by: @djc

Base: mainHead: relax_mut


📝 Commits (2)

  • a2f80c0 Relax mut requirements for resolver.clear_cache() and add cache flushing example
  • aca26b2 Make resolver.clear_cache() a sync fn and cleanup example output

📊 Changes

4 files changed (+105 additions, -6 deletions)

View changed files

crates/resolver/examples/flush_cache.rs (+101 -0)
📝 crates/resolver/src/async_resolver.rs (+1 -1)
📝 crates/resolver/src/caching_client.rs (+1 -1)
📝 crates/resolver/src/resolver.rs (+2 -4)

📄 Description

The example queries four hostnames for TXT records in parallel, then outputs the times it took for the application.

$ cargo run --example flush_cache

...
first_resolve: 140.221767ms
cached_resolve: 674.524µs
second_resolve: 21.810073ms

First is when the network cache is cold.
Cached is when the application itself has the records already.
Second is with the network cache already hot.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/hickory-dns/hickory-dns/pull/1747 **Author:** [@dns2utf8](https://github.com/dns2utf8) **Created:** 7/27/2022 **Status:** ✅ Merged **Merged:** 8/1/2022 **Merged by:** [@djc](https://github.com/djc) **Base:** `main` ← **Head:** `relax_mut` --- ### 📝 Commits (2) - [`a2f80c0`](https://github.com/hickory-dns/hickory-dns/commit/a2f80c0bbc752babc15e2bed60c2510bfbc96c9e) Relax mut requirements for resolver.clear_cache() and add cache flushing example - [`aca26b2`](https://github.com/hickory-dns/hickory-dns/commit/aca26b20a84b7270df6734d34631e239357f26a3) Make resolver.clear_cache() a sync fn and cleanup example output ### 📊 Changes **4 files changed** (+105 additions, -6 deletions) <details> <summary>View changed files</summary> ➕ `crates/resolver/examples/flush_cache.rs` (+101 -0) 📝 `crates/resolver/src/async_resolver.rs` (+1 -1) 📝 `crates/resolver/src/caching_client.rs` (+1 -1) 📝 `crates/resolver/src/resolver.rs` (+2 -4) </details> ### 📄 Description The example queries four hostnames for TXT records in parallel, then outputs the times it took for the application. ```bash $ cargo run --example flush_cache ... first_resolve: 140.221767ms cached_resolve: 674.524µs second_resolve: 21.810073ms ``` First is when the network cache is cold. Cached is when the application itself has the records already. Second is with the network cache already hot. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-16 10:11:59 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/hickory-dns#2560
No description provided.