pub struct DnsCache { /* private fields */ }Expand description
DNS cache with LRU eviction and TTL-based expiry
Implementations§
Source§impl DnsCache
impl DnsCache
Sourcepub fn lookup(
&mut self,
name: &str,
rtype: DnsRecordType,
) -> Option<Vec<DnsRecord>>
pub fn lookup( &mut self, name: &str, rtype: DnsRecordType, ) -> Option<Vec<DnsRecord>>
Look up a cached record by name and type
Sourcepub fn insert(&mut self, name: &str, record: DnsRecord, ttl: u32)
pub fn insert(&mut self, name: &str, record: DnsRecord, ttl: u32)
Insert a record into the cache with the given TTL
Sourcepub fn evict_expired(&mut self, now: u64)
pub fn evict_expired(&mut self, now: u64)
Remove all expired entries