Struct hickory_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
Trait Implementations§
Auto Trait Implementations§
impl Freeze for DnsLru
impl !RefUnwindSafe for DnsLru
impl Send for DnsLru
impl Sync for DnsLru
impl Unpin for DnsLru
impl !UnwindSafe for DnsLru
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more