Core/getFromCache
From PunchCMS
PCMS_Client->getFromCache(method, elementId, [arguments])
Overview
Get the output of a method from the cache. If the cache is disabled or the content has not been cached yet this method will call the requested method and return/cache the output.
Arguments
method [string/array]
The method from which the output should be cached. If the method is a static method of a class the argument should be formated as an array like this
array("CLASS", "METHOD");
elementId [integer]
Id of the element this call should be tied to. If this element gets updated in the CMS the cache file will be removed to reflect the change.
arguments [mixed, optional]
Optional arguments that need to be passed to the called method. More than one argument should be placed in an array.
Returns
The output of the called method. Either cached or fresh.
Example
$objCms = PCMS_Client::getInstance(); // Cache the output of a parse method. $objElement = $objCms->getElementById(1234); $strOutput = $objCms->getFromCache("parseHeader", $objElement->getId(), $objElement); // Cache the output of an auxiliary static method of the class "Tools". $arrMethod = array("Tools", "parseTitle"); $arrArguments = array("My", "title"); $strOutput = $objCms->getFromCache($arrMethod, 1234, $arrArguments);