Struct trust_dns_resolver::dns_lru::DnsLru
source · pub struct DnsLru { /* private fields */ }
Expand description
And LRU eviction cache specifically for storing DNS records
Implementations§
source§impl DnsLru
impl DnsLru
sourcepub fn new(capacity: usize, ttl_cfg: TtlConfig) -> Self
pub fn new(capacity: usize, ttl_cfg: TtlConfig) -> Self
Construct a new cache
Arguments
capacity
- size in number of records, this can be the max size of 2048 (record size) *capacity
ttl_cfg
- force minimums and maximums for cached records
sourcepub fn insert_records(
&self,
original_query: Query,
records: impl Iterator<Item = Record>,
now: Instant
) -> Option<Lookup>
pub fn insert_records(
&self,
original_query: Query,
records: impl Iterator<Item = Record>,
now: Instant
) -> Option<Lookup>
inserts a record based on the name and type.
Arguments
original_query
- is used for matching the records that should be returnedrecords
- the records will be partitioned by type and name for storage in the cachenow
- current time for use in associating TTLs
Return
This should always return some records, but will be None if there are no records or the original_query matches none