MySQL 8.0.33
Source Code Documentation
sp_cache.h
Go to the documentation of this file.
1/* -*- C++ -*- */
2/* Copyright (c) 2002, 2023, Oracle and/or its affiliates.
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License, version 2.0,
6 as published by the Free Software Foundation.
7
8 This program is also distributed with certain software (including
9 but not limited to OpenSSL) that is licensed under separate terms,
10 as designated in a particular file or component or in included license
11 documentation. The authors of MySQL hereby grant you an additional
12 permission to link the program and your derivative works with the
13 separately licensed software that they have included with MySQL.
14
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License, version 2.0, for more details.
19
20 You should have received a copy of the GNU General Public License
21 along with this program; if not, write to the Free Software
22 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
23
24#ifndef _SP_CACHE_H_
25#define _SP_CACHE_H_
26
27#include <sys/types.h>
28
29#include "my_inttypes.h"
30
31/*
32 Stored procedures/functions cache. This is used as follows:
33 * Each thread has its own cache.
34 * Each sp_head object is put into its thread cache before it is used, and
35 then remains in the cache until deleted.
36*/
37
38class sp_cache;
39class sp_head;
40class sp_name;
41
42/*
43 Cache usage scenarios:
44 1. SP execution in thread:
45 1.1 While holding sp_head* pointers:
46
47 // look up a routine in the cache (no checks if it is up to date or not)
48 sp_cache_lookup();
49
50 sp_cache_insert();
51 sp_cache_invalidate();
52
53 1.2 When not holding any sp_head* pointers:
54 sp_cache_flush_obsolete();
55
56 2. Before thread exit:
57 sp_cache_clear();
58*/
59
60void sp_cache_clear(sp_cache **cp);
61void sp_cache_insert(sp_cache **cp, sp_head *sp);
66void sp_cache_enforce_limit(sp_cache *cp, ulong upper_limit_for_elements);
67
68#endif /* _SP_CACHE_H_ */
Definition: sp_cache.cc:41
sp_head represents one instance of a stored program.
Definition: sp_head.h:379
Definition: sp_head.h:119
Some integer typedefs for easier portability.
int64_t int64
Definition: my_inttypes.h:67
sp_head * sp_cache_lookup(sp_cache **cp, const sp_name *name)
Definition: sp_cache.cc:153
void sp_cache_insert(sp_cache **cp, sp_head *sp)
Definition: sp_cache.cc:124
void sp_cache_flush_obsolete(sp_cache **cp, sp_head **sp)
Remove an out-of-date SP from the cache.
Definition: sp_cache.cc:187
void sp_cache_enforce_limit(sp_cache *cp, ulong upper_limit_for_elements)
Enforce that the current number of elements in the cache don't exceed the argument value by flushing ...
Definition: sp_cache.cc:208
int64 sp_cache_version()
Return the current global version of the cache.
Definition: sp_cache.cc:198
void sp_cache_invalidate()
Definition: sp_cache.cc:171
void sp_cache_clear(sp_cache **cp)
Definition: sp_cache.cc:101
case opt name
Definition: sslopt-case.h:32