The SQL cache

SPIP stores certain database elements in a cache in order to prevent over-working the SQL server, and so that the public pages already cached can be displayed if the database server doesn’t work for some reason. There are two such caches created for these purposes.

Cache of the meta data

The first cache is a complete export of the SQL table spip_meta. This table stores the parameters used for configuring and running SPIP. These data are stored both in the global variable $GLOBALS['meta'] and, except for sensitive data used for authentication, in the file named tmp/meta_cache.php. This file has a validity period defined by _META_CACHE_TIME. It is rewritten when calls are made to ecrire_meta() or effacer_meta(). The function lire_metas() recalculates the contents of this cache $GLOBALS['meta'] using the current data in the database.

Cache of SQL descriptions

The second cache concerns the descriptions of the database SQL tables. These descriptions are stored in the tmp/cache/sql_desc*.txt files, along with a file for each database connector. This file is created and used by the function base_trouver_table_dist(), which is used by various PHP functions for SQL descriptions like table_objet(), id_table_objet(), and objet_type().

To create this cache file, it is necessary to explicitly call the function trouver_table() without any arguments: