mirror of
https://github.com/fergalmoran/DnsServer.git
synced 2026-01-06 08:45:32 +00:00
CacheZoneTree: renamed TryRemove() to TryRemoveTree() and added out int to return number of removed entries from the all the cache zones.
This commit is contained in:
@@ -37,9 +37,13 @@ namespace DnsServerCore.Dns.Trees
|
||||
|
||||
#region public
|
||||
|
||||
public override bool TryRemove(string domain, out CacheZone value)
|
||||
public bool TryRemoveTree(string domain, out CacheZone value, out int removedEntries)
|
||||
{
|
||||
bool removed = TryRemove(domain, out value, out Node currentNode);
|
||||
if (removed)
|
||||
removedEntries = value.TotalEntries;
|
||||
else
|
||||
removedEntries = 0;
|
||||
|
||||
//remove all cache zones under current zone
|
||||
Node current = currentNode;
|
||||
@@ -59,6 +63,7 @@ namespace DnsServerCore.Dns.Trees
|
||||
current.RemoveNodeValue(v.Key, out _); //remove node value
|
||||
current.CleanThisBranch();
|
||||
removed = true;
|
||||
removedEntries += zone.TotalEntries;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user