Closed williamb1024 closed 1 year ago
A request to a server which might not have the answer can take several seconds sometimes. So yeah, in the meantime, the result might got cached.
What would be the advantage of moving the cache check outside of the loop? Also keep in mind that the overhead (time) doing the cache check is basically irrelevant.
I agree the time savings would be negligible and insignificant in comparison to the time waiting for a server response. My primary reason for asking was to determine how open you'd be to moving things around in ResolveQuery and ResolveQueryAsync.
I'm going to close this and hopefully continue the conversation in the #198 issue instead.
Are you open to the idea of lifting cache checks outside of the server loop in LookupClient.ResolveQuery() and LookupClient.ResolveQueryAsync()?
There really is no point in performing the check once per-server unless you are expecting a request from a different context to have completed and updated the cache.
The cache check should be wrapped in a conditional ensuring that at least one server is included in the
servers
argument. This would ensure that the code continues to operate in the same manner as it does now.