Customizing the High Level Caching System
High Level Caching is a system is present within the CMS to reduce database usage and speed up general page loads.
The high level caching system is extendable, so a developer can add to the conditions that determine whether or not a page is cached.
Here's how high level caching works:
http://path.to/members/?highlevelcachedebug=1
(Replace http://path.to/members/ with the URL to your members area).
Any front facing page covered by the CMS can have the argument highlevelcachedebug=1 added to it. If high level cache is enabled, you'll see a debug page listing cache dependencies.
Here, you'll see two categories of dependencies - temporary and permanent.
Temporary dependencies are things that may change, such as when the database was last updated, when the template was last updated, stuff like that.
Permanent dependencies are things that don't change, such as what page you're on (index,gallery), what id it's trying to access (1,2,3), what page you're on (1,2,3), or what type you're trying to access (highres, vids).
Both the temporary dependencies and the permanent dependencies are separately serialized, and hashed into an md5sum. The permanent md5sum determines the directory structure within /cms_admin/storage/cache/, and the temporary dependency determines the name of the file within the cache store:
Example:
/1e/00/1b/fa/5a/d9/30/56/dd/39/cf/81/03/08/bb/79/43c68e04b4b75378539774c940398f75
The file that's stored is the HTML output of the page. By having high level caching turned on, it's saving hits to the database, and the template transform process.
Adding to the cache dependency:
1) You'll need to add the following to cmsinclude.ini.php in your members area:
CACHEDEPENDENCY_FUNC=myCacheFunc
Use this guide for help:
https://support.elevatedx.com/index.php?/Knowledgebase/Article/View/85/0/integrate-custom-php-code
Within a separate PHP include, you'll need to define:
function myCacheFunc(&$deps)
{
// example piece of code.
$deps["perm"]["xxx"] = $_GET["xxx"];
}
There, you'll need to add dependencies to the cache engine as you see fit. This way, the system will take into account any variables you take into account.