MySQL 8.3.0
Source Code Documentation
cache.h
Go to the documentation of this file.
1/* Copyright (c) 2020, 2023, Oracle and/or its affiliates.
2
3This program is free software; you can redistribute it and/or modify
4it under the terms of the GNU General Public License, version 2.0,
5as published by the Free Software Foundation.
6
7This program is also distributed with certain software (including
8but not limited to OpenSSL) that is licensed under separate terms,
9as designated in a particular file or component or in included license
10documentation. The authors of MySQL hereby grant you an additional
11permission to link the program and your derivative works with the
12separately licensed software that they have included with MySQL.
13
14This program is distributed in the hope that it will be useful,
15but WITHOUT ANY WARRANTY; without even the implied warranty of
16MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17GNU General Public License, version 2.0, for more details.
18
19You should have received a copy of the GNU General Public License
20along with this program; if not, write to the Free Software
21Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
22
25
26#include <set>
27#include <string>
28#include <unordered_map>
29#include "cache_allocator.h"
31
32namespace reference_caching {
33
34class channel_imp;
35
36class cache_imp : public Cache_malloced {
37 public: /* top level APIs */
39 SERVICE_TYPE(registry) * registry);
40 static bool destroy(cache_imp *cache);
41 bool get(unsigned service_name_index, const my_h_service **ref);
42 bool flush();
43 ~cache_imp();
44
45 protected:
46 explicit cache_imp(channel_imp *channel, SERVICE_TYPE(registry) * registry);
47
48 private:
49 // disable copy constructors
52
54 /*
55 This is a opaque pointer handle used to store the acquired service
56 implementation handles.
57 */
62 unsigned int m_cache_version;
64};
65
66} // namespace reference_caching
Definition: cache_allocator.h:30
Definition: cache.h:36
service_names_set m_service_names
Definition: cache.h:60
channel_imp * m_channel
Definition: cache.h:53
static bool destroy(cache_imp *cache)
Definition: cache.cc:41
my_h_service ** m_cache
Definition: cache.h:58
cache_imp & operator=(const cache_imp &)
cache_imp(channel_imp *channel, const mysql_service_registry_t *registry)
Definition: cache.cc:180
service_names_set< std::string, std::less< std::string > > m_ignore_list
Definition: cache.h:61
static cache_imp * create(channel_imp *channel, const mysql_service_registry_t *registry)
Definition: cache.cc:32
~cache_imp()
Definition: cache.cc:189
bool m_populated
Definition: cache.h:63
bool get(unsigned service_name_index, const my_h_service **ref)
Definition: cache.cc:46
const mysql_service_registry_t * m_registry
Definition: cache.h:59
cache_imp(const cache_imp &)
bool flush()
Definition: cache.cc:160
unsigned int m_cache_version
Definition: cache.h:62
Definition: channel.h:35
Definition: reference_cache_common.h:59
struct my_h_service_imp * my_h_service
A handle type for acquired Service.
Definition: registry.h:32
PT & ref(PT *tp)
Definition: tablespace_impl.cc:358
Definition: cache.cc:31
#define SERVICE_TYPE(name)
Generates the standard Service type name.
Definition: service.h:75
Definition: task.h:426