MCPcopy Create free account
hub / github.com/DNSCrypt/encrypted-dns-server / new

Method new

src/cache.rs:17–26  ·  view source on GitHub ↗
(cache: &Cache, response: Vec<u8>)

Source from the content-addressed store, hash-verified

15
16impl CachedResponse {
17 pub fn new(cache: &Cache, response: Vec<u8>) -> Self {
18 let ttl = dns::min_ttl(&response, cache.ttl_min, cache.ttl_max, cache.ttl_error)
19 .unwrap_or(cache.ttl_error);
20 let expiry = Instant::recent() + Duration::from_secs(u64::from(ttl));
21 CachedResponse {
22 response,
23 expiry,
24 original_ttl: ttl,
25 }
26 }
27
28 #[inline]
29 pub fn set_tid(&mut self, tid: u16) {

Callers

nothing calls this directly

Calls 2

min_ttlFunction · 0.85
newFunction · 0.85

Tested by

no test coverage detected