allowCaching()
public final function allowCaching($atAll, $ifUserLoggedIn = true, $ifGetSet = true, $ifPostSet = true, $ifSessionSet = true, $ifCookieSet = true)
This function lets you tell the CMS that your Plugin supports caching, and under which situations it can be cached.
From within your init() or showSlot() methods, from Zenario 7.0.0 onwards.
Some editions of the CMS have a page caching feature which stores copies of Content Items in the cache directory. There is also a Plugin caching feature which can store the output of each Plugin individually.
By default, the CMS assumes that your Plugin cannot be cached, and any page your Plugin is placed on will not be placed in the cache.
If you wish to make your Plugin work with caching then you must call this function to let the CMS know when it may be cached. You should then also call the clearCacheBy() function.
$atAll
Whether to enable caching.
Note that if you set this to false, then the values of the remaining parameters are irrelevant.
$ifUserLoggedIn
Whether to enable caching if an Extranet User is logged in.
Menus or Content Lists that contain private items, or other Plugins that display information specific to the current User, should not allow themselves to be cached when an Extranet User is logged in.
If you use the zenario.userId variable in your JavaScript code or reference the zenario_userLoggedIn class name in your CSS then you should also set this flag.
Note that it's not possible to enable caching when an Administrator is logged in.
$ifGetSet
Whether to enable caching when there is a variable in the GET request, that is not part of the canonical URL to the current page.
A canonical URL is the URL that a page is indexed under in search engines such as Google.
The CMS considers "cID" and "cType" to form the canonical URL. Plugins on a page can add extra variables to the canonical URL by calling the registerGetRequest() initialization function.
An example: a Content Summary List Plugin registers page as part of the canonical URL. If a Visitor is on a page with a Content Summary List, and navigates to the second page of a list, they might see a URL of "index.php?cID=1&cType=html&page=2". This is a canonical URL as all of the requests in it are registered, and this would be cached.
A non-example: a Search Results Plugin does not call registerGetRequest(). If a Visitor is on a page with a Search Entry Box, and does a search for the word "hello", they might see a URL of "index.php?cID=1&cType=html&searchString=hello". This is not a canonical URL as it contains a request in it that is not registered, and this would not be cached.
$ifPostSet
Whether to enable caching when there is a variable in the POST request.
Plugins that handle form submission should not allow themselves to be cached when the POST is set.
$ifSessionSet
Whether to enable caching when there is a variable set in the Visitor's session.
Note that a few session variables set by the CMS - such as the Extranet User Id, the last visited Content Item and the last visited Language Id - do not count towards this.
$ifCookieSet
Whether to enable caching when a Visitor has a cookie from this site.
Note that any cookies set by session_start() in PHP do not count towards this. However the "Remember Me" cookies for Extranet Users and Administrators do count.
$this->allowCaching(
$atAll = true, $ifUserLoggedIn = true, $ifGetSet = true, $ifPostSet = true,
$ifSessionSet = true, $ifCookieSet = true);
Enables caching for a Plugin.
$this->allowCaching(
$atAll = true, $ifUserLoggedIn = false, $ifGetSet = true, $ifPostSet = true,
$ifSessionSet = false, $ifCookieSet = false);
Enables caching for a Plugin in specific situations.
$this->allowCaching(false);
This will disable caching for a Plugin.
Caching is disabled by default, but if you've enabled earlier in your code you can use this to change your mind. If you are extending a Module that has caching enabled you will also need to make a second call to allowCaching() and clearCacheBy() if the caching rules for your Module differ.