My Project
sp_cache.h
00001 /* -*- C++ -*- */
00002 /* Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
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; version 2 of the License.
00007 
00008    This program is distributed in the hope that it will be useful,
00009    but WITHOUT ANY WARRANTY; without even the implied warranty of
00010    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00011    GNU General Public License for more details.
00012 
00013    You should have received a copy of the GNU General Public License
00014    along with this program; if not, write to the Free Software Foundation,
00015    51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */
00016 
00017 #ifndef _SP_CACHE_H_
00018 #define _SP_CACHE_H_
00019 
00020 #include "my_global.h"                          /* ulong */
00021 
00022 /*
00023   Stored procedures/functions cache. This is used as follows:
00024    * Each thread has its own cache.
00025    * Each sp_head object is put into its thread cache before it is used, and
00026      then remains in the cache until deleted.
00027 */
00028 
00029 class sp_head;
00030 class sp_cache;
00031 class sp_name;
00032 
00033 /*
00034   Cache usage scenarios:
00035   1. Application-wide init:
00036     sp_cache_init();
00037 
00038   2. SP execution in thread:
00039   2.1 While holding sp_head* pointers:
00040   
00041     // look up a routine in the cache (no checks if it is up to date or not)
00042     sp_cache_lookup(); 
00043     
00044     sp_cache_insert();
00045     sp_cache_invalidate();
00046   
00047   2.2 When not holding any sp_head* pointers:
00048     sp_cache_flush_obsolete();
00049   
00050   3. Before thread exit:
00051     sp_cache_clear();
00052 */
00053 
00054 void sp_cache_init();
00055 void sp_cache_clear(sp_cache **cp);
00056 void sp_cache_insert(sp_cache **cp, sp_head *sp);
00057 sp_head *sp_cache_lookup(sp_cache **cp, sp_name *name);
00058 void sp_cache_invalidate();
00059 void sp_cache_flush_obsolete(sp_cache **cp, sp_head **sp);
00060 ulong sp_cache_version();
00061 void sp_cache_enforce_limit(sp_cache *cp, ulong upper_limit_for_elements);
00062 
00063 #endif /* _SP_CACHE_H_ */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines