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:
Shreyas Zare
2022-04-23 17:50:10 +05:30
parent 181e57d194
commit 1b00b0ba09

View File

@@ -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;
}
}
}