Add clear_resolved_cache implementation #893
Conversation
@@ -36,18 +36,21 @@ struct async_resolver : std::enable_shared_from_this<async_resolver<Tag> > { | |||
typedef std::function<void(resolver_type &, string_type, std::uint16_t, | |||
resolve_completion_function)> resolve_function; | |||
|
|||
void clear_resolved_cache() { clear_cache_ = true; } |
deanberris
Jan 11, 2021
Member
You probably want to make clear_cache_
an std::atomic<bool>
so that it's thread-safe to modify it from different threads.
You probably want to make clear_cache_
an std::atomic<bool>
so that it's thread-safe to modify it from different threads.
if (clear_cache_) { | ||
clear_cache_ = false; | ||
endpoint_cache_.clear(); | ||
} |
deanberris
Jan 11, 2021
Member
This will have to change if you use an std::atomic<bool>
to reset the value to false
. Something like:
if (clear_cache_.exchange(false)) {
endpoint_cache_.clear()
}
This will have to change if you use an std::atomic<bool>
to reset the value to false
. Something like:
if (clear_cache_.exchange(false)) {
endpoint_cache_.clear()
}
basic_client_facade
write aclear_resolved_cache()
but no functions are implemented with pimpl. Add implementation for async_resolver and sync_resolver.