From 54d1705f8733016b918dbc26d26522e1cbdafde4 Mon Sep 17 00:00:00 2001 From: Kees Monshouwer Date: Thu, 20 Apr 2017 00:59:37 +0200 Subject: [PATCH] query cache hit/miss statistics --- pdns/auth-querycache.cc | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) 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; } -- 2.47.2