MySQL 9.7.0
Source Code Documentation
HostCache::HostCacheImpl Class Reference
Inheritance diagram for HostCache::HostCacheImpl:
[legend]

Public Types

using VectorOfAddresses = std::vector< net::ip::address >
 
- Public Types inherited from HostCacheStatisticsComponent
using TemporaryEntryPtr = std::shared_ptr< host_cache::TemporaryEntry >
 

Public Member Functions

 HostCacheImpl (std::shared_ptr< HostCacheConfig > config)
 
 ~HostCacheImpl () override=default
 
ResolveHostResult resolve_host (const std::string &hostname, CachePolicy cache_policy)
 
- Public Member Functions inherited from HostCacheStatisticsComponent
virtual ~HostCacheStatisticsComponent ()=default
 

Private Types

enum class  LookupResult { CachedEntry , TemporaryEntry }
 
using State = host_cache::TemporaryEntry::State
 
using TemporaryEntry = host_cache::TemporaryEntry
 
using TemporaryEntryPtr = std::shared_ptr< host_cache::TemporaryEntry >
 
using Entry = host_cache::Entry
 
using second = std::chrono::seconds
 

Private Member Functions

uint32_t get_minimum_ttl_impl (const ResolveHostResult &result)
 
std::chrono::seconds get_minimum_ttl (const ResolveHostResult &result)
 
void try_purge_expired_entries ()
 
LookupResult lookup_cache (const Hostname &hostname, const CachePolicy cache_policy, ResolvedAddresses *out_cached, TemporaryEntryPtr *out_temporary)
 
void temporary_finished (TemporaryEntryPtr &temporary_entry, const bool store_result)
 
void temporary_process_result (TemporaryEntryPtr &temporary_entry, const ResolveHostResult &result)
 
void temporary_resolving (TemporaryEntryPtr &temporary_entry)
 
std::vector< host_cache::Entryget_entries () override
 
std::vector< TemporaryEntryPtrget_temporary_entries () override
 
uint64_t get_temporary_size () override
 
uint64_t get_cache_hits () override
 
uint64_t get_cache_size () override
 
uint64_t get_cache_inserts () override
 
uint64_t get_cache_drops () override
 
uint64_t get_cache_used () override
 
uint64_t get_cache_expired () override
 

Static Private Member Functions

static bool is_entry_valid (const Entry::time_point &tp, const Entry *entry)
 
static bool is_entry_valid (const Entry *entry)
 

Private Attributes

std::atomic< uint64_t > cache_hits_tot_ {0}
 
std::atomic< uint64_t > cache_inserts_tot_ {0}
 
std::atomic< uint64_t > cache_uses_tot_ {0}
 
std::atomic< uint64_t > cache_drops_expired_tot_ {0}
 
std::atomic< uint64_t > cache_drops_tot_ {0}
 
const std::shared_ptr< HostCacheConfigconfig_
 
std::map< Hostname, TemporaryEntryPtrtemporary_entries_
 
LruCache cache_
 
std::mt19937 rand_engine_
 
std::uniform_real_distribution< double > distribution_ {-1.0, 1.0}
 
std::mutex context_mutex_
 

Member Typedef Documentation

◆ Entry

◆ second

◆ State

◆ TemporaryEntry

◆ TemporaryEntryPtr

◆ VectorOfAddresses

Member Enumeration Documentation

◆ LookupResult

enum class HostCache::HostCacheImpl::LookupResult
strongprivate
Enumerator
CachedEntry 
TemporaryEntry 

Constructor & Destructor Documentation

◆ HostCacheImpl()

HostCache::HostCacheImpl::HostCacheImpl ( std::shared_ptr< HostCacheConfig config)
inline

◆ ~HostCacheImpl()

HostCache::HostCacheImpl::~HostCacheImpl ( )
overridedefault

Member Function Documentation

◆ get_cache_drops()

uint64_t HostCache::HostCacheImpl::get_cache_drops ( )
inlineoverrideprivatevirtual

◆ get_cache_expired()

uint64_t HostCache::HostCacheImpl::get_cache_expired ( )
inlineoverrideprivatevirtual

◆ get_cache_hits()

uint64_t HostCache::HostCacheImpl::get_cache_hits ( )
inlineoverrideprivatevirtual

◆ get_cache_inserts()

uint64_t HostCache::HostCacheImpl::get_cache_inserts ( )
inlineoverrideprivatevirtual

◆ get_cache_size()

uint64_t HostCache::HostCacheImpl::get_cache_size ( )
inlineoverrideprivatevirtual

◆ get_cache_used()

uint64_t HostCache::HostCacheImpl::get_cache_used ( )
inlineoverrideprivatevirtual

◆ get_entries()

std::vector< host_cache::Entry > HostCache::HostCacheImpl::get_entries ( )
inlineoverrideprivatevirtual

◆ get_minimum_ttl()

std::chrono::seconds HostCache::HostCacheImpl::get_minimum_ttl ( const ResolveHostResult result)
inlineprivate

◆ get_minimum_ttl_impl()

uint32_t HostCache::HostCacheImpl::get_minimum_ttl_impl ( const ResolveHostResult result)
inlineprivate

◆ get_temporary_entries()

std::vector< TemporaryEntryPtr > HostCache::HostCacheImpl::get_temporary_entries ( )
inlineoverrideprivatevirtual

◆ get_temporary_size()

uint64_t HostCache::HostCacheImpl::get_temporary_size ( )
inlineoverrideprivatevirtual

◆ is_entry_valid() [1/2]

static bool HostCache::HostCacheImpl::is_entry_valid ( const Entry entry)
inlinestaticprivate

◆ is_entry_valid() [2/2]

static bool HostCache::HostCacheImpl::is_entry_valid ( const Entry::time_point tp,
const Entry entry 
)
inlinestaticprivate

◆ lookup_cache()

LookupResult HostCache::HostCacheImpl::lookup_cache ( const Hostname hostname,
const CachePolicy  cache_policy,
ResolvedAddresses out_cached,
TemporaryEntryPtr out_temporary 
)
inlineprivate

◆ resolve_host()

ResolveHostResult HostCache::HostCacheImpl::resolve_host ( const std::string &  hostname,
CachePolicy  cache_policy 
)
inline

◆ temporary_finished()

void HostCache::HostCacheImpl::temporary_finished ( TemporaryEntryPtr temporary_entry,
const bool  store_result 
)
inlineprivate

◆ temporary_process_result()

void HostCache::HostCacheImpl::temporary_process_result ( TemporaryEntryPtr temporary_entry,
const ResolveHostResult result 
)
inlineprivate

◆ temporary_resolving()

void HostCache::HostCacheImpl::temporary_resolving ( TemporaryEntryPtr temporary_entry)
inlineprivate

◆ try_purge_expired_entries()

void HostCache::HostCacheImpl::try_purge_expired_entries ( )
inlineprivate

Member Data Documentation

◆ cache_

LruCache HostCache::HostCacheImpl::cache_
private

◆ cache_drops_expired_tot_

std::atomic<uint64_t> HostCache::HostCacheImpl::cache_drops_expired_tot_ {0}
private

◆ cache_drops_tot_

std::atomic<uint64_t> HostCache::HostCacheImpl::cache_drops_tot_ {0}
private

◆ cache_hits_tot_

std::atomic<uint64_t> HostCache::HostCacheImpl::cache_hits_tot_ {0}
private

◆ cache_inserts_tot_

std::atomic<uint64_t> HostCache::HostCacheImpl::cache_inserts_tot_ {0}
private

◆ cache_uses_tot_

std::atomic<uint64_t> HostCache::HostCacheImpl::cache_uses_tot_ {0}
private

◆ config_

const std::shared_ptr<HostCacheConfig> HostCache::HostCacheImpl::config_
private

◆ context_mutex_

std::mutex HostCache::HostCacheImpl::context_mutex_
private

◆ distribution_

std::uniform_real_distribution<double> HostCache::HostCacheImpl::distribution_ {-1.0, 1.0}
private

◆ rand_engine_

std::mt19937 HostCache::HostCacheImpl::rand_engine_
private

◆ temporary_entries_

std::map<Hostname, TemporaryEntryPtr> HostCache::HostCacheImpl::temporary_entries_
private

The documentation for this class was generated from the following file: