25#ifndef AUTH_UTILITY_INCLUDED
26#define AUTH_UTILITY_INCLUDED
36template <
typename K,
typename V>
61 const auto search_itr =
m_map.find(
key);
62 if (search_itr !=
m_map.end()) {
63 value = search_itr->second;
81 auto returns =
m_map.insert(std::make_pair(
key, value));
82 return returns.second;
Map with RWLock protections.
Definition: auth_utility.h:37
size_t size()
Get the size of the map.
Definition: auth_utility.h:106
Map_with_rw_lock(const Map_with_rw_lock &)=delete
~Map_with_rw_lock()
Definition: auth_utility.h:44
void clear_if_greater(size_t size)
Check limit and clear if needed.
Definition: auth_utility.h:100
void erase(K key)
Delete an entry.
Definition: auth_utility.h:90
mysql_rwlock_t m_lock
Lock to protect m_map.
Definition: auth_utility.h:115
Map_with_rw_lock & operator=(Map_with_rw_lock &&)=delete
std::map< K, V > m_map
Map.
Definition: auth_utility.h:113
Map_with_rw_lock(PSI_rwlock_key key)
Definition: auth_utility.h:39
Map_with_rw_lock & operator=(const Map_with_rw_lock &)=delete
bool find(const K &key, V &value)
Search an entry.
Definition: auth_utility.h:59
Map_with_rw_lock(Map_with_rw_lock &&)=delete
bool insert(K key, V value)
Insert an entry.
Definition: auth_utility.h:79
Locks RW-lock and releases lock on scope exit.
Definition: rwlock_scoped_lock.h:32
#define mysql_rwlock_init(K, T)
Definition: mysql_rwlock.h:41
#define mysql_rwlock_destroy(T)
Definition: mysql_rwlock.h:51
unsigned int PSI_rwlock_key
Instrumented rwlock key.
Definition: psi_rwlock_bits.h:44
Instrumentation helpers for rwlock.
required string key
Definition: replication_asynchronous_connection_failover.proto:60
An instrumented rwlock structure.
Definition: mysql_rwlock_bits.h:51