From: Kees Monshouwer Date: Wed, 19 Apr 2017 22:59:37 +0000 (+0200) Subject: query cache hit/miss statistics X-Git-Tag: rec-4.1.0-alpha1~151^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=refs%2Fpull%2F5258%2Fhead;p=thirdparty%2Fpdns.git query cache hit/miss statistics --- diff --git a/pdns/auth-querycache.cc b/pdns/auth-querycache.cc index e91349c5ab..e9c9e7b6e1 100644 --- a/pdns/auth-querycache.cc +++ b/pdns/auth-querycache.cc @@ -31,8 +31,6 @@ extern StatBag S; const unsigned int AuthQueryCache::s_mincleaninterval, AuthQueryCache::s_maxcleaninterval; -extern StatBag S; - AuthQueryCache::AuthQueryCache(size_t mapsCount): d_lastclean(time(nullptr)) { d_maps.resize(mapsCount); @@ -128,13 +126,18 @@ bool AuthQueryCache::getEntryLocked(cmap_t& map, const DNSName &qname, uint16_t auto& idx = boost::multi_index::get(map); auto iter = idx.find(tie(qname, qtype, zoneID)); - if (iter == idx.end()) + if (iter == idx.end()) { + (*d_statnummiss)++; return false; + } - if (iter->ttd < now) + if (iter->ttd < now) { + (*d_statnummiss)++; return false; + } value = iter->drs; + (*d_statnumhit)++; return true; }