MySQL  8.0.18
Source Code Documentation
sp_cache.h
Go to the documentation of this file.
1 /* -*- C++ -*- */
2 /* Copyright (c) 2002, 2017, Oracle and/or its affiliates. All rights reserved.
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 
38 class sp_cache;
39 class sp_head;
40 class 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 
60 void sp_cache_clear(sp_cache **cp);
61 void sp_cache_insert(sp_cache **cp, sp_head *sp);
63 void sp_cache_invalidate();
66 void sp_cache_enforce_limit(sp_cache *cp, ulong upper_limit_for_elements);
67 
68 #endif /* _SP_CACHE_H_ */
const string name("\ame\)
Some integer typedefs for easier portability.
Definition: sp_cache.cc:41
void sp_cache_clear(sp_cache **cp)
Definition: sp_cache.cc:101
int64 sp_cache_version()
Return the current global version of the cache.
Definition: sp_cache.cc:198
sp_head * sp_cache_lookup(sp_cache **cp, sp_name *name)
Definition: sp_cache.cc:153
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
int64_t int64
Definition: my_inttypes.h:67
void sp_cache_insert(sp_cache **cp, sp_head *sp)
Definition: sp_cache.cc:124
sp_head represents one instance of a stored program.
Definition: sp_head.h:405
void sp_cache_enforce_limit(sp_cache *cp, ulong upper_limit_for_elements)
Enforce that the current number of elements in the cache don&#39;t exceed the argument value by flushing ...
Definition: sp_cache.cc:208
void sp_cache_invalidate()
Definition: sp_cache.cc:171
unsigned long ulong
Definition: my_inttypes.h:48
Definition: sp_head.h:125