Actions

API16

JCachePage/get

From Joomla! Documentation

< API16:JCachePage
Replacement filing cabinet.png
This Namespace has been archived - Please Do Not Edit or Create Pages in this namespace. Pages contain information for a Joomla! version which is no longer supported. It exists only as a historical reference, will not be improved and its content may be incomplete.

Contents

Description

Get the cached page data

[<! removed edit link to red link >]

<! 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 edit link to red link >] <! removed transcluded page call, red link never existed >

Examples

<CodeExamplesForm />