pub struct Cache {
inner: PartitionedCache<DomainName, RecordType, RecordTypeWithData>,
}
Expand description
Caching for ResourceRecord
s.
You probably want to use SharedCache
instead.
Fields§
§inner: PartitionedCache<DomainName, RecordType, RecordTypeWithData>
Implementations§
Source§impl Cache
impl Cache
Sourcepub fn with_desired_size(desired_size: usize) -> Self
pub fn with_desired_size(desired_size: usize) -> Self
Create a new cache with the given desired size.
The prune
method will remove expired entries, and also enough entries
(in least-recently-used order) to get down to this size.
Sourcepub fn get(
&mut self,
name: &DomainName,
qtype: QueryType,
) -> Vec<ResourceRecord>
pub fn get( &mut self, name: &DomainName, qtype: QueryType, ) -> Vec<ResourceRecord>
Get RRs from the cache.
The TTL in the returned ResourceRecord
is relative to the
current time - not when the record was inserted into the
cache.
Sourcepub fn get_without_checking_expiration(
&mut self,
name: &DomainName,
qtype: QueryType,
) -> Vec<ResourceRecord>
pub fn get_without_checking_expiration( &mut self, name: &DomainName, qtype: QueryType, ) -> Vec<ResourceRecord>
Like get
, but may return expired RRs.
Consumers MUST check that the TTL of a record is nonzero before using it!
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 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
Mutably borrows from an owned value. Read more