Changeset 1204

Show
Ignore:
Timestamp:
06/17/08 23:33:18 (4 months ago)
Author:
ahu
Message:

implement wiping of the negative query cache, plus document it. suggested by simon kirby

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/pdns/pdns/docs/pdns.sgml

    r1203 r1204  
    139139            </para> 
    140140          </listitem> 
     141          <listitem> 
     142            <para> 
     143              <command>rec_control wipe-cache</command> now also wipes domains from the negative cache, hurrying up the expiry 
     144              of negatively cached records. Suggested by Simon Kirby, implemented in c1204. 
     145            </para> 
     146          </listitem> 
     147 
    141148          <listitem> 
    142149            <para> 
  • trunk/pdns/pdns/rec_channel_rec.cc

    r1196 r1204  
    9191string doWipeCache(T begin, T end) 
    9292{ 
    93   int count=0
    94   for(T i=begin; i != end; ++i) 
     93  int count=0, countNeg=0
     94  for(T i=begin; i != end; ++i) { 
    9595    count+=RC.doWipeCache(toCanonic("", *i)); 
    96  
    97   return "wiped "+lexical_cast<string>(count)+" records\n"; 
     96    string canon=toCanonic("", *i); 
     97    countNeg+=SyncRes::s_negcache.count(tie(canon)); 
     98    pair<SyncRes::negcache_t::iterator, SyncRes::negcache_t::iterator> range=SyncRes::s_negcache.equal_range(tie(canon)); 
     99    SyncRes::s_negcache.erase(range.first, range.second); 
     100  } 
     101 
     102  return "wiped "+lexical_cast<string>(count)+" records, "+lexical_cast<string>(countNeg)+" negative records\n"; 
    98103} 
    99104