MySQL 9.0.0
Source Code Documentation
cache.h
Go to the documentation of this file.
1/* Copyright (c) 2020, 2024, 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 designed to work 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 either included with
13the program or referenced in the documentation.
14
15This program is distributed in the hope that it will be useful,
16but WITHOUT ANY WARRANTY; without even the implied warranty of
17MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18GNU General Public License, version 2.0, for more details.
19
20You should have received a copy of the GNU General Public License
21along with this program; if not, write to the Free Software
22Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
23
26
27#include <set>
28#include <string>
29#include <unordered_map>
30#include "cache_allocator.h"
32
33namespace reference_caching {
34
35class channel_imp;
36
37class cache_imp : public Cache_malloced {
38 public: /* top level APIs */
40 SERVICE_TYPE(registry) * registry);
41 static bool destroy(cache_imp *cache);
42 bool get(unsigned service_name_index, const my_h_service **ref);
43 bool flush();
44 ~cache_imp();
45
46 protected:
47 explicit cache_imp(channel_imp *channel, SERVICE_TYPE(registry) * registry);
48
49 private:
50 // disable copy constructors
53
55 /*
56 This is a opaque pointer handle used to store the acquired service
57 implementation handles.
58 */
63 unsigned int m_cache_version;
65};
66
67} // namespace reference_caching
Definition: cache_allocator.h:31
Definition: cache.h:37
service_names_set m_service_names
Definition: cache.h:61
channel_imp * m_channel
Definition: cache.h:54
static bool destroy(cache_imp *cache)
Definition: cache.cc:42
my_h_service ** m_cache
Definition: cache.h:59
cache_imp & operator=(const cache_imp &)
cache_imp(channel_imp *channel, const mysql_service_registry_t *registry)
Definition: cache.cc:181
service_names_set< std::string, std::less< std::string > > m_ignore_list
Definition: cache.h:62
static cache_imp * create(channel_imp *channel, const mysql_service_registry_t *registry)
Definition: cache.cc:33
~cache_imp()
Definition: cache.cc:190
bool m_populated
Definition: cache.h:64
bool get(unsigned service_name_index, const my_h_service **ref)
Definition: cache.cc:47
const mysql_service_registry_t * m_registry
Definition: cache.h:60
cache_imp(const cache_imp &)
bool flush()
Definition: cache.cc:161
unsigned int m_cache_version
Definition: cache.h:63
Definition: channel.h:36
Definition: reference_cache_common.h:60
struct my_h_service_imp * my_h_service
A handle type for acquired Service.
Definition: registry.h:33
PT & ref(PT *tp)
Definition: tablespace_impl.cc:359
Definition: cache.cc:32
#define SERVICE_TYPE(name)
Generates the standard Service type name.
Definition: service.h:76
Definition: task.h:427