#include <dns_cache.hpp>
Classes | |
| struct | DNSResult |
Public Member Functions | |
| bool | lookup (const std::string &host, std::vector< std::string > &out) |
| std::string | lookup_one (const std::string &host) |
| void | store (const std::string &host, const std::vector< std::string > &addrs, int ttl_seconds=-1) |
| void | set_default_ttl (int seconds) |
| void | clear () |
| size_t | size () const |
Static Public Member Functions | |
| static DNSCache & | instance () |
Private Member Functions | |
| DNSCache ()=default | |
| DNSCache (const DNSCache &)=delete | |
| DNSCache & | operator= (const DNSCache &)=delete |
Private Attributes | |
| std::mutex | mu_ |
| std::unordered_map< std::string, DNSResult > | map_ |
| int | default_ttl_ = 60 |
Definition at line 28 of file dns_cache.hpp.
|
privatedefault |
Referenced by DNSCache(), instance(), and operator=().
|
privatedelete |
References DNSCache().
| void DNSCache::clear | ( | ) |
Definition at line 73 of file dns_cache.cpp.
|
static |
Definition at line 26 of file dns_cache.cpp.
References DNSCache().
Referenced by resolve_with_cache().
| bool DNSCache::lookup | ( | const std::string & | host, |
| std::vector< std::string > & | out ) |
Definition at line 31 of file dns_cache.cpp.
Referenced by lookup_one().
| std::string DNSCache::lookup_one | ( | const std::string & | host | ) |
Definition at line 46 of file dns_cache.cpp.
References lookup().
References DNSCache().
| void DNSCache::set_default_ttl | ( | int | seconds | ) |
Definition at line 68 of file dns_cache.cpp.
References default_ttl_, and mu_.
| size_t DNSCache::size | ( | ) | const |
| void DNSCache::store | ( | const std::string & | host, |
| const std::vector< std::string > & | addrs, | ||
| int | ttl_seconds = -1 ) |
Definition at line 53 of file dns_cache.cpp.
References default_ttl_, map_, and mu_.
Referenced by resolve_with_cache().
|
private |
Definition at line 53 of file dns_cache.hpp.
Referenced by set_default_ttl(), and store().
|
private |
|
mutableprivate |
Definition at line 51 of file dns_cache.hpp.
Referenced by clear(), lookup(), set_default_ttl(), size(), and store().