MySQL 9.0.0
Source Code Documentation
sp_cache.cc File Reference
#include "sql/sp_cache.h"
#include <stddef.h>
#include <atomic>
#include <memory>
#include <string>
#include "lex_string.h"
#include "map_helpers.h"
#include "my_dbug.h"
#include "mysql/strings/m_ctype.h"
#include "sql/psi_memory_key.h"
#include "sql/sp_head.h"

Classes

class  sp_cache
 
struct  sp_cache::sp_head_deleter
 

Functions

void sp_cache_clear (sp_cache **cp)
 
void sp_cache_insert (sp_cache **cp, sp_head *sp)
 
sp_headsp_cache_lookup (sp_cache **cp, const sp_name *name)
 
void sp_cache_invalidate ()
 
void sp_cache_flush_obsolete (sp_cache **cp, sp_head **sp)
 Remove an out-of-date SP from the cache. More...
 
int64 sp_cache_version ()
 Return the current global version of the cache. More...
 
void sp_cache_enforce_limit (sp_cache *c, ulong upper_limit_for_elements)
 Enforce that the current number of elements in the cache don't exceed the argument value by flushing the cache if necessary. More...
 
bool sp_cache_has (sp_cache *cp, sp_head *sp)
 Check if the sp_cache contains the specified stored program. More...
 

Variables

static std::atomic< int64atomic_Cversion {0}
 

Function Documentation

◆ sp_cache_clear()

void sp_cache_clear ( sp_cache **  cp)

◆ sp_cache_enforce_limit()

void sp_cache_enforce_limit ( sp_cache c,
ulong  upper_limit_for_elements 
)

Enforce that the current number of elements in the cache don't exceed the argument value by flushing the cache if necessary.

Parameters
[in]cCache to check
[in]upper_limit_for_elementsSoft upper limit for number of sp_head objects that can be stored in the cache.

◆ sp_cache_flush_obsolete()

void sp_cache_flush_obsolete ( sp_cache **  cp,
sp_head **  sp 
)

Remove an out-of-date SP from the cache.

Parameters
[in]cpCache to flush
[in]spSP to remove.
Note
This invalidates pointers to sp_head objects this thread uses. In practice that means 'dont call this function when inside SP'.

◆ sp_cache_has()

bool sp_cache_has ( sp_cache cp,
sp_head sp 
)

Check if the sp_cache contains the specified stored program.

Note
If the sp is part of a recursion, check if the first instance is part of the sp_cache
Parameters
[in]cp- the sp_cache that is to be checked.
[in]sp- the stored program that needs to be part of that cache.
Returns
true if the element is in the cache.
false if not.

◆ sp_cache_insert()

void sp_cache_insert ( sp_cache **  cp,
sp_head sp 
)

◆ sp_cache_invalidate()

void sp_cache_invalidate ( )

◆ sp_cache_lookup()

sp_head * sp_cache_lookup ( sp_cache **  cp,
const sp_name name 
)

◆ sp_cache_version()

int64 sp_cache_version ( )

Return the current global version of the cache.

Variable Documentation

◆ atomic_Cversion

std::atomic<int64> atomic_Cversion {0}
static