From: Otto Moerbeek Date: Wed, 16 Sep 2020 09:44:59 +0000 (+0200) Subject: Introduce an invalidate() method instead of assigning directly X-Git-Tag: rec-4.5.0-alpha0^2~2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=bf46420e5627280a9c34b0d0880efd6052c1b9c1;p=thirdparty%2Fpdns.git Introduce an invalidate() method instead of assigning directly --- diff --git a/pdns/cachecleaner.hh b/pdns/cachecleaner.hh index 2bca3b3f78..a06a35e086 100644 --- a/pdns/cachecleaner.hh +++ b/pdns/cachecleaner.hh @@ -144,7 +144,7 @@ template uint64_t pruneMutexCollectionsVect for (auto& mc : maps) { const typename C::lock l(mc); - mc.d_cachecachevalid = false; + mc.invalidate(); auto& sidx = boost::multi_index::get(mc.d_map); uint64_t erased = 0, lookedAt = 0; for (auto i = sidx.begin(); i != sidx.end(); lookedAt++) { @@ -178,7 +178,7 @@ template uint64_t pruneMutexCollectionsVect size_t pershard = toTrim / maps_size + 1; for (auto& mc : maps) { const typename C::lock l(mc); - mc.d_cachecachevalid = false; + mc.invalidate(); auto& sidx = boost::multi_index::get(mc.d_map); size_t removed = 0; for (auto i = sidx.begin(); i != sidx.end() && removed < pershard; removed++) { diff --git a/pdns/recursor_cache.hh b/pdns/recursor_cache.hh index d2f66cef58..8166ddab8a 100644 --- a/pdns/recursor_cache.hh +++ b/pdns/recursor_cache.hh @@ -214,6 +214,11 @@ private: std::atomic d_entriesCount{0}; uint64_t d_contended_count{0}; uint64_t d_acquired_count{0}; + + void invalidate() + { + d_cachecachevalid = false; + } }; vector d_maps; diff --git a/pdns/recursordist/negcache.hh b/pdns/recursordist/negcache.hh index d27432426e..1618d5af72 100644 --- a/pdns/recursordist/negcache.hh +++ b/pdns/recursordist/negcache.hh @@ -115,7 +115,7 @@ private: std::atomic d_entriesCount{0}; mutable uint64_t d_contended_count{0}; mutable uint64_t d_acquired_count{0}; - bool d_cachecachevalid{false}; // XXX + void invalidate() {} }; vector d_maps;