pub struct DnsLru { /* private fields */ }
Expand description
An LRU eviction cache specifically for storing DNS records
Implementations§
Source§impl DnsLru
impl DnsLru
Sourcepub fn new(capacity: usize, ttl_config: TtlConfig) -> Self
pub fn new(capacity: usize, ttl_config: TtlConfig) -> Self
Construct a new cache
§Arguments
capacity
- size in number of cached queriesttl_config
- minimum and maximum TTLs 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)