pub struct Cache { /* private fields */ }Expand description
The RDAP answers a finder holds, and for how long.
The regional registries limit how often you can ask, and a run that reports a spam wave asks about the same few networks again and again. An answer for an address is held for the whole network range the registry returned, so it also answers for every other address in that range. An answer for a domain is held for that name.
A clone shares the answers with the original. Give a clone to
crate::Finder::with_cache and keep one to call Cache::clear.
The cache drops an answer when its time is over, the next time it stores one. It
sets no other limit on its size. Read Cache::len and call Cache::clear
when you want one.
DNS answers are not held here. The resolver holds them for the TTL of the record.
Implementations§
Source§impl Cache
impl Cache
Sourcepub const DEFAULT_HOLD: Duration
pub const DEFAULT_HOLD: Duration
How long Cache::default holds an answer.
Sourcepub fn new(hold: Duration) -> Self
pub fn new(hold: Duration) -> Self
Returns an empty cache that holds each answer for this long.
A hold of zero holds nothing, so every lookup asks the registry.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Cache
impl RefUnwindSafe for Cache
impl Send for Cache
impl Sync for Cache
impl Unpin for Cache
impl UnsafeUnpin for Cache
impl UnwindSafe for Cache
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more