API16:JCachePage/get
From Joomla! Documentation
Description
Get the cached page data
<! removed transcluded page call, red link never existed >
Syntax
get($id=false, $group='page')
| Parameter Name | Default Value | Description |
|---|---|---|
| $id | false | $id The cache data id |
| $group | 'page' | $group The cache data group |
Returns
boolean True if the cache is hit (false else)
Defined in
libraries/joomla/cache/handler/page.php
Importing
jimport( 'joomla.cache.handler.page' );
Source Body
function get($id=false, $group='page')
{
// Initialise variables.
$data = false;
// If an id is not given generate it from the request
if ($id == false) {
$id = $this->_makeId();
}
// If the etag matches the page id ... sent a no change header and exit : utilize browser cache
if (!headers_sent() && isset($_SERVER['HTTP_IF_NONE_MATCH'])){
$etag = stripslashes($_SERVER['HTTP_IF_NONE_MATCH']);
if ($etag == $id) {
$browserCache = isset($this->_options['browsercache']) ? $this->_options['browsercache'] : false;
if ($browserCache) {
$this->_noChange();
}
}
}
// We got a cache hit... set the etag header and echo the page data
$data = parent::get($id, $group);
if ($data !== false) {
$this->_setEtag($id);
return $data;
}
// Set id and group placeholders
$this->id = $id;
$this->group = $group;
return false;
}
<! removed transcluded page call, red link never existed >
Examples
Code Examples