00001 /* -*- C++ -*- */ 00002 /* Copyright (C) 2002 MySQL AB 00003 00004 This program is free software; you can redistribute it and/or modify 00005 it under the terms of the GNU General Public License as published by 00006 the Free Software Foundation; either version 2 of the License, or 00007 (at your option) any later version. 00008 00009 This program is distributed in the hope that it will be useful, 00010 but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 GNU General Public License for more details. 00013 00014 You should have received a copy of the GNU General Public License 00015 along with this program; if not, write to the Free Software 00016 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ 00017 00018 #ifndef _SP_CACHE_H_ 00019 #define _SP_CACHE_H_ 00020 00021 #ifdef USE_PRAGMA_INTERFACE 00022 #pragma interface /* gcc class implementation */ 00023 #endif 00024 00025 /* 00026 Stored procedures/functions cache. This is used as follows: 00027 * Each thread has its own cache. 00028 * Each sp_head object is put into its thread cache before it is used, and 00029 then remains in the cache until deleted. 00030 */ 00031 00032 class sp_head; 00033 class sp_cache; 00034 00035 /* 00036 Cache usage scenarios: 00037 1. Application-wide init: 00038 sp_cache_init(); 00039 00040 2. SP execution in thread: 00041 2.1 While holding sp_head* pointers: 00042 00043 // look up a routine in the cache (no checks if it is up to date or not) 00044 sp_cache_lookup(); 00045 00046 sp_cache_insert(); 00047 sp_cache_invalidate(); 00048 00049 2.2 When not holding any sp_head* pointers: 00050 sp_cache_flush_obsolete(); 00051 00052 3. Before thread exit: 00053 sp_cache_clear(); 00054 */ 00055 00056 void sp_cache_init(); 00057 void sp_cache_clear(sp_cache **cp); 00058 void sp_cache_insert(sp_cache **cp, sp_head *sp); 00059 sp_head *sp_cache_lookup(sp_cache **cp, sp_name *name); 00060 void sp_cache_invalidate(); 00061 void sp_cache_flush_obsolete(sp_cache **cp); 00062 00063 #endif /* _SP_CACHE_H_ */
1.4.7

