|
|
|
The concept behind Dynamic Content Caching is to store results of a first execution of a dynamically generated Web page. In this way, further requests made to the same page, will go to the Cache. Consequently, avoiding the overhead incurred by executing an application that renders output that does not change.
Zend Platform offers two ways to Content Cache files.
Full Page Content Caching - For cases where it is possible to cache an entire output.
Partial Page Content Caching - for cases where it is impractical or impossible to cache the entire output.
There are two caching conditions that can be applied to files:
Default Full Page Content Caching settings can be applied to all files marked as cached in: Performance | Settings and going to the Dynamic Content Caching section of the settings screen.
Specific Full Page Content Caching configurations can be applied to specific files by going to: Performance | File View.
Default Full Page Content Caching settings are applied to all files marked as cached in: Performance | Settings and go to the Dynamic Content Caching section of the Settings screen.
The content caching options are as follows:
The lifetime and conditions settings in the Settings tab are default values. These settings can be modified per file or per directory in the File View workspace.
Dynamic Content Caching Settings are as follows:
Dynamic Caching Enabled On – The Dynamic Content Caching is active and working. Off – The Dynamic Content Caching is not in use.
Maximum Cache Size -The maximum size allocated for cache. Occasionally and for short periods of time, this value may be exceeded but only until the next time that the Cache Cleaner deletes the files that expired. Set to "0" for an unlimited cache size.
Minimum Free Disk space - The minimal reserved free disk space required. Reaching this value will end any further caching. The caching will resume as soon as the space is greater than this value.
Maximum Cached File Size - The maximum allowed output cache file size. An output cache file that exceeds this value will not be cached. Set to "0" for an unlimited cache size.
Default Cache Lifetime - The lifetime, in seconds, of cached data. The data will be re-generated if the cached version is older than the expiration time.
Note:
The Cache Cleaner is directly related to the directive zend_accelerator.cache_cleaner_freq that can be defined in the Configure PHP Settings screen. This directive defines when expired cache files are removed from the cache.
Back to content caching options
By default, Dynamic Content Caching, caches each request based on its full URL (ALLGET). You can condition the settings to be more general or more specific, as desired.
To change default caching conditions:
Go to Performance | Settings and go to the Dynamic Content Caching section of the settings screen. Select, Change Default Conditions to open the Define Default Caching Conditions dialog.
The default caching condition is ALLGET, which means that the entire GET string is used to identify a cached item. The GET string includes everything that appears after the question mark in a URL. (The ALLGET variables can be found in the $_GET PHP array as well).
The following actions and conditions can be applied to the Default Caching settings:
To limit the ALLGET condition, select Except from the restrictions drop down list, to exclude a specific GET variable from the ALLGET.
To change the ALLGET condition, select a new condition from the drop down list.
To add another condition, press Add Condition and select another condition type from the list. Type the variables in the new condition row and restrict if necessary. The same condition can be used several times, each time with a different restriction.
To remove any condition, click the delete icon next to the condition you wish to cancel.
To change the Cache Lifetime’s duration, type the new number (in seconds).
When all configurations are completed, press Save to save and close the dialog. Modified settings will be immediately displayed in the Settings tab. Click “Apply Changes” and restart the Web server to activate the new caching conditions. The message will remain on the screen until the server is actually restarted.
Note:
Caching conditions may also apply to Variables stored in an Array.
Back to content caching options
The following list includes a description each of the applicable parameters.
GET - Indicates that you have selected certain GET variables.For example, consider the URL: http://www.mysite.com/myscript.php?color=blue&size=LWhen set to ALL GET, a new request for myscript.php?color=blue&size=M, will not be taken from the cache and will be regenerated. If, however, the setting is changed to GET, with the value ‘color’, then the 2 URL requests would both be taken from the same cache content, regardless of the order of the variables in the request string. (The GET variables can be found in the $_GET PHP array as well).
COOKIE - The Cookie variable is the variable given in the HTTP cookie. (It can be found in PHP $_COOKIE array as well). By selecting a cookie variable, it will also be considered a determining factor for cache hits, in the same way that GET variables are considered.
REQUEST - The variable is set by the GET or COOKIE methods. (Can be found in PHP $_REQUEST array as well).
SERVER - Server variable is set as a server environment variable When selecting a server variable, (those listed in PHP $_SERVER array) it will also be used as a determining factor for cache hits, in the same way that GET variables are considered. To define a Server variable, select a variable from the list or choose Add a new variable to type in another variable.
SESSION -The SESSION variable is useful when PHP sessions are in use. (Can be found in PHP $_SESSION array as well). Note: 1. If a script is cached using a SESSION variable and the session does not start in this script, the script will not be cached.2. If a script is cached using a SESSION variable, yet the cookies are disabled on the user side and the SESSION ID is embedded directly into the URL, the caching will not take place.
ALLSESSION - The script depends on all of the variables present in the session. (Can be found in $_SESSION PHP array as well).
Note:
It is mandatory to choose at least one Dependency.
Back to content caching options