This shows you the differences between two versions of the page.

Link to this comparison view

v1.4:caching [2012/11/04 21:31]
Studio384 created
v1.4:caching [2013/03/17 19:53] (current)
Studio384 #812: Copy Franz's cache page for 1.4
Line 1: Line 1:
 ====== Caching ====== ====== Caching ======
-FIXME+In order to increase performance,​ FluxBB makes use of caching techniques in various places across the software. 
 +This allows us to store results of frequently executed database queries for faster access directly on the file system. 
 +===== Loading from cache ===== 
 +To load cached data, all you have to do is including the cache file (if it exists) -- that will make a global variable available that contains the data: 
 +<code php> 
 +// Load cached configuration 
 +if (file_exists(FORUM_CACHE_DIR.'​cache_config.php'​)) 
 +    include FORUM_CACHE_DIR.'​cache_config.php';​ 
 +If the file does not exist, the cache has to be regenerated first. 
 +===== Regenerating the cache ===== 
 +In order to not show old data on the forum, you need to make sure that the cache files are regenerated when you make changes to that data in the database. As an example, the ''​generate_quickjump_cache()''​ has to be called after changing group permissions for a specific forum. 
 +This code shows how to regenerate the configuration cache, which should be done after updating config values in the database: 
 +<code php> 
 +if (!defined('​FORUM_CACHE_FUNCTIONS_LOADED'​)) 
 +    require PUN_ROOT.'​include/​cache.php';​ 
 +// Regenerate the config cache 
 +The function names for the other caches are easy to guess: 
 +  * ''​generate_bans_cache()''​ 
 +  * ''​generate_quickjump_cache()''​ 
 +  * ''​generate_censoring_cache()''​ 
 +  * ''​generate_stopwords_cache()''​ 
 +  * ''​generate_users_info_cache()''​ 
 +The ''​generate_quickjump_cache()''​ function is special in that it can also accept a parameter to only regenerate the quickjump list for a certain user group. Just pass a valid group ID to the function to make use of that feature.