pub fn dns_cache(self, cache: impl Into<DnsCache>) -> Self {
        // This option is per-request, but we only expose it on the client.
        // Since the DNS cache is shared between all requests, exposing this
        // option per-request would actually cause the timeout to alternate
        // values for every request with a different timeout, resulting in some
        // confusing (but valid) behavior.
        self.configure(cache.into())
    }
/// Configure DNS caching.
///
/// By default, DNS entries are cached by the client executing the request
/// and are used until the entry expires. Calling this method allows you to
/// change the entry timeout duration or disable caching completely.
///
/// Note that DNS entry TTLs are not respected, regardless of this setting.
///
/// By default caching is enabled with a 60 second timeout.
///
/// # Examples
///
/// ```
/// # use isahc::config::*;
/// # use isahc::prelude::*;
/// # use std::time::Duration;
/// #
/// let client = HttpClient::builder()
///     // Cache entries for 10 seconds.
///     .dns_cache(Duration::from_secs(10))
///     // Cache entries forever.
///     .dns_cache(DnsCache::Forever)
///     // Don't cache anything.
///     .dns_cache(DnsCache::Disable)
///     .build()?;
/// # Ok::<(), isahc::Error>(())
/// ```
Configure DNS caching.
By default, DNS entries are cached by the client executing the request
and are used until the entry expires. Calling this method allows you to
change the entry timeout duration or disable caching completely.

Note that DNS entry TTLs are not respected, regardless of this setting.

By default caching is enabled with a 60 second timeout.
Configure DNS caching . By default DNS entries are cached by the client executing the request and are used until the entry expires . Calling this method allows you to change the entry timeout duration or disable caching completely . Note that DNS entry TTLs are not respected regardless of this setting . By default caching is enabled with a 60 second timeout .
pub fn dns_cache(self, cache: impl Into<DnsCache>) -> Self {
        // This option is per-request, but we only expose it on the client.
        // Since the DNS cache is shared between all requests, exposing this
        // option per-request would actually cause the timeout to alternate
        // values for every request with a different timeout, resulting in some
        // confusing (but valid) behavior.
        self.configure(cache.into())
    }
pub fn dns_cache ( self , cache : impl Into < DnsCache > ) -> Self { // This option is per-request, but we only expose it on the client. // Since the DNS cache is shared between all requests, exposing this // option per-request would actually cause the timeout to alternate // values for every request with a different timeout, resulting in some // confusing (but valid) behavior. self . configure ( cache . into ( ) ) }
Configure DNS caching.
Configure DNS caching .
self
cache
impl Into<DnsCache>
self
cache
impl Into<DnsCache>
examples
None
use isahc::config::*;
None
use isahc::prelude::*;
None
use std::time::duration;
let client = HttpClient::builder()
Cache entries for 10 seconds.
.dns_cache(Duration::from_secs(10))
Cache entries forever.
.dns_cache(DnsCache::Forever)
Don't cache anything.
.dns_cache(DnsCache::Disable)
.build()?.
let client = HttpClient :: builder () Cache entries for 10 seconds . . dns_cache ( Duration :: from_secs ( 10 )) Cache entries forever . . dns_cache ( DnsCache :: Forever ) Don ' t cache anything . . dns_cache ( DnsCache :: Disable ) . build () ? .
ok::<(), isahc::error>(())
None