sources/bind9/lib/dns/rbtdb.c
/*%
 * See if a given cache entry that is being reused needs to be updated
 * in the LRU-list.  From the LRU management point of view, this function is
 * expected to return true for almost all cases.  When used with threads,
 * however, this may cause a non-negligible performance penalty because a
 * writer lock will have to be acquired before updating the list.
 * If DNS_RBTDB_LIMITLRUUPDATE is defined to be non 0 at compilation time, this
 * function returns true if the entry has not been updated for some period of
 * time.  We differentiate the NS or glue address case and the others since
 * experiments have shown that the former tends to be accessed relatively
 * infrequently and the cost of cache miss is higher (e.g., a missing NS records
 * may cause external queries at a higher level zone, involving more
 * transactions).
 *
 * Caller must hold the node (read or write) lock.
 */
%
See if a given cache entry that is being reused needs to be updated
in the LRU-list.  From the LRU management point of view, this function is
expected to return true for almost all cases.  When used with threads,
however, this may cause a non-negligible performance penalty because a
writer lock will have to be acquired before updating the list.
If DNS_RBTDB_LIMITLRUUPDATE is defined to be non 0 at compilation time, this
function returns true if the entry has not been updated for some period of
time.  We differentiate the NS or glue address case and the others since
experiments have shown that the former tends to be accessed relatively
infrequently and the cost of cache miss is higher .

Caller must hold the node (read or write) lock.
% See if a given cache entry that is being reused needs to be updated in the LRU - list . From the LRU management point of view this function is expected to return true for almost all cases . When used with threads however this may cause a non - negligible performance penalty because a writer lock will have to be acquired before updating the list . If DNS_RBTDB_LIMITLRUUPDATE is defined to be non 0 at compilation time this function returns true if the entry has not been updated for some period of time . We differentiate the NS or glue address case and the others since experiments have shown that the former tends to be accessed relatively infrequently and the cost of cache miss is higher . Caller must hold the node ( read or write ) lock .
static inline isc_boolean_t
need_headerupdate(rdatasetheader_t *header, isc_stdtime_t now) {
	if ((header->attributes &
	     (RDATASET_ATTR_NONEXISTENT|RDATASET_ATTR_STALE)) != 0)
		return (ISC_FALSE);
#if DNS_RBTDB_LIMITLRUUPDATE
	if (header->type == dns_rdatatype_ns ||
	    (header->trust == dns_trust_glue &&
	     (header->type == dns_rdatatype_a ||
	      header->type == dns_rdatatype_aaaa))) {
		return (header->last_used + 60 <= now);
	}
	return (header->last_used + 300 <= now);
#else
	UNUSED(now);
	return (ISC_TRUE);
#endif
}
static inline isc_boolean_t need_headerupdate ( rdatasetheader_t * header , isc_stdtime_t now ) { if ( ( header -> attributes & ( RDATASET_ATTR_NONEXISTENT | RDATASET_ATTR_STALE ) ) != 0 ) return ( ISC_FALSE ) ; #if DNS_RBTDB_LIMITLRUUPDATE if ( header -> type == dns_rdatatype_ns || ( header -> trust == dns_trust_glue && ( header -> type == dns_rdatatype_a || header -> type == dns_rdatatype_aaaa ) ) ) { return ( header -> last_used + 60 <= now ) ; } return ( header -> last_used + 300 <= now ) ; #else UNUSED ( now ) ; return ( ISC_TRUE ) ; #endif }
%
 See if a given cache entry that is being reused needs to be updated
 in the LRU-list.
% See if a given cache entry that is being reused needs to be updated in the LRU - list .
/*
		 * Glue records are updated if at least 60 seconds have passed
		 * since the previous update time.
		 */ /* Other records are updated if 5 minutes have passed. */