API15

JCachePage/get

From Joomla! Documentation

< API15:JCachePage

The "API15" namespace is an archived namespace. This page contains information for a Joomla! version which is no longer supported. It exists only as a historical reference, it will not be improved and its content may be incomplete and/or contain broken links.

Description[edit]

Get the cached page data

[<! removed edit link to red link >]

<! removed transcluded page call, red link never existed >

Syntax[edit]

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[edit]

boolean True if the cache is hit (false else)

Defined in[edit]

libraries/joomla/cache/handler/page.php

Importing[edit]

jimport( 'joomla.cache.handler.page' );

Source Body[edit]

function get( $id=false, $group='page' )
{
        // Initialize 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[edit]

Code Examples[edit]