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
sourceimpl 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 !RefUnwindSafe for DnsLru
impl Send for DnsLru
impl Sync for DnsLru
impl Unpin for DnsLru
impl !UnwindSafe for DnsLru
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
fn vzip(self) -> V
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more