lua: resurrect cache.clear('name')
(Continuation of https://gitlab.labs.nic.cz/knot/knot-resolver/merge_requests/583)
See the caveats described in docs.
Further suggestions
-
For both functions we might add support to only consider exact name matches instead of subtrees, e.g. via optionally passing trueas second parameter.
cache.clear():
-
The return values are inconsistent. Proposal (slightly incompatible change): even if called without parameters, we return the number of removed records or a negative number on error (instead of bool). -
We may add code doing asynchronous larger purges as suggested in docs.
cache.get():
-
Recognize CNAME and DNAME. -
truedoesn't allow to distinguish unvalidated negative records or outdated records. We might e.g. output something more useful thantrue.
Edited by Vladimír Čunát