MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
sp_cache.h
1 /* -*- C++ -*- */
2 /* Copyright (c) 2002, 2011, 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 as published by
6  the Free Software Foundation; version 2 of the License.
7 
8  This program is distributed in the hope that it will be useful,
9  but WITHOUT ANY WARRANTY; without even the implied warranty of
10  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  GNU General Public License for more details.
12 
13  You should have received a copy of the GNU General Public License
14  along with this program; if not, write to the Free Software Foundation,
15  51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */
16 
17 #ifndef _SP_CACHE_H_
18 #define _SP_CACHE_H_
19 
20 #include "my_global.h" /* ulong */
21 
22 /*
23  Stored procedures/functions cache. This is used as follows:
24  * Each thread has its own cache.
25  * Each sp_head object is put into its thread cache before it is used, and
26  then remains in the cache until deleted.
27 */
28 
29 class sp_head;
30 class sp_cache;
31 class sp_name;
32 
33 /*
34  Cache usage scenarios:
35  1. Application-wide init:
36  sp_cache_init();
37 
38  2. SP execution in thread:
39  2.1 While holding sp_head* pointers:
40 
41  // look up a routine in the cache (no checks if it is up to date or not)
42  sp_cache_lookup();
43 
44  sp_cache_insert();
45  sp_cache_invalidate();
46 
47  2.2 When not holding any sp_head* pointers:
48  sp_cache_flush_obsolete();
49 
50  3. Before thread exit:
51  sp_cache_clear();
52 */
53 
54 void sp_cache_init();
55 void sp_cache_clear(sp_cache **cp);
56 void sp_cache_insert(sp_cache **cp, sp_head *sp);
57 sp_head *sp_cache_lookup(sp_cache **cp, sp_name *name);
58 void sp_cache_invalidate();
59 void sp_cache_flush_obsolete(sp_cache **cp, sp_head **sp);
60 ulong sp_cache_version();
61 void sp_cache_enforce_limit(sp_cache *cp, ulong upper_limit_for_elements);
62 
63 #endif /* _SP_CACHE_H_ */