MySQL 8.0.40
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#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
44 public: /* utility */
45 cache_imp(channel_imp *channel, SERVICE_TYPE(registry) * registry);
46 ~cache_imp();
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};
63
64} // namespace reference_caching
Definition: cache_allocator.h:31
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:36
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:138
static cache_imp * create(channel_imp *channel, const mysql_service_registry_t *registry)
Definition: cache.cc:30
~cache_imp()
Definition: cache.cc:143
bool get(unsigned service_name_index, const my_h_service **ref)
Definition: cache.cc:41
const mysql_service_registry_t * m_registry
Definition: cache.h:59
cache_imp(const cache_imp &)
bool flush()
Definition: cache.cc:119
service_names_set m_ignore_list
Definition: cache.h:61
Definition: channel.h:32
Definition: reference_cache_common.h:37
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:29
#define SERVICE_TYPE(name)
Generates the standard Service type name.
Definition: service.h:76
Definition: task.h:427