pub trait ResolverCache<K, V>: Sized {
// Required methods
fn get<Q>(&self, name: &Q) -> Option<V>
where K: Borrow<Q>,
Q: Hash + Eq + ?Sized;
fn remove<Q>(&self, name: &Q) -> Option<V>
where K: Borrow<Q>,
Q: Hash + Eq + ?Sized;
fn insert(&self, key: K, value: V, valid_until: Instant);
}Expand description
A cache for one DNS record type, keyed by K and holding values of type
V.
Methods take &self, so implementations that mutate must use interior
mutability (a lock or a concurrent map). The lookup helpers call
get before querying and insert after a
query that returned records or a cacheable negative answer; they do not
check expiry themselves. See the module documentation for an
example.
Required Methods§
Sourcefn get<Q>(&self, name: &Q) -> Option<V>
fn get<Q>(&self, name: &Q) -> Option<V>
Returns a copy of the cached value for name, or None if there is
none. Implementations should return None for expired entries.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".