This class contains functions for the output cache handler in CONTENIDO.

package Core
subpackage Cache

 Methods

Constructor of cOutputCacheHandler.

__construct(array $aConf, \cDb $db, int $iCreateCode) 

Does some checks and sets the configuration of cache object.

Parameters

$aConf

array

Configuration of caching as follows: - $a['excludecontenido'] bool. don't cache output, if we have a CONTENIDO variable, e. g. on calling frontend preview from backend - $a['enable'] bool. activate caching of frontend output - $a['debug'] bool. compose debuginfo (hit/miss and execution time of caching) - $a['infotemplate'] string. debug information template - $a['htmlcomment'] bool. add a html comment including several debug messages to output - $a['lifetime'] int. lifetime in seconds 2 cache output - $a['cachedir'] string. directory where cached content is 2 store. - $a['cachegroup'] string. cache group, will be a subdirectory inside cachedir - $a['cacheprefix'] string. add prefix 2 stored filenames - $a['idoptions'] array. several variables 2 create a unique id, if the output depends on them. e. g. array('uri'=>$_SERVER['REQUEST_URI'],'post'=>$_POST,'get'=>$_GET);

$db

\cDb

CONTENIDO database object

$iCreateCode

int

Flag of createcode state from table con_cat_art

Add option 4 caching (e.

addOption(string $name, string $option) : void
Inherited

g. $_GET,$_POST, $_COOKIE, ...). Used 2 generate the id for caching.

inherited_from \cOutputCache::addOption()

Parameters

$name

string

Name of option

$option

string

Value of option (any variable)

Set/Get the flag 2 debug cache object (prints out miss/hit state with execution time).

debug(bool $debug) : mixed
Inherited
inherited_from \cOutputCache::debug()

Parameters

$debug

bool

True 2 activate debugging or false.

Returns

mixedDebug flag or void

Set/Get the flag 2 enable caching.

enable(bool $enable) : mixed
Inherited
inherited_from \cOutputCache::enable()

Parameters

$enable

bool

True 2 enable caching or false

Returns

mixedEnable flag or void

Handles ending of PEAR caching.

end() : void
Inherited
inherited_from \cOutputCache::end()

Returns information cache hit/miss and execution time if caching is enabled.

getInfo() : string
Inherited
inherited_from \cOutputCache::getInfo()

Returns

stringInformation about cache if caching is enabled, otherwhise nothing.

Set/Get flag 2 print out cache info as html comment.

htmlComment(bool $htmlcomment) : void
Inherited
inherited_from \cOutputCache::htmlComment()

Parameters

$htmlcomment

bool

True debugging or false.

Set/Get template to use on printing the chache info.

infoTemplate(string $template) : void
Inherited
inherited_from \cOutputCache::infoTemplate()

Parameters

$template

string

Template string including the '%s' format definition.

Set/Get caching lifetime in seconds.

lifetime(int $seconds) : mixed
Inherited
inherited_from \cOutputCache::lifetime()

Parameters

$seconds

int

New Lifetime in seconds

Returns

mixedActual lifetime or void

Removes any cached content if exists.

removeFromCache() : void
Inherited

This is nesessary to delete cached articles, if they are changed on backend.

inherited_from \cOutputCache::removeFromCache()

Handles PEAR caching.

start(int $iPageStartTime) : void
Inherited

The script will be terminated by calling die(), if any cached content is found.

inherited_from \cOutputCache::start()

Parameters

$iPageStartTime

int

Optional start time, e. g. start time of main script

Returns microtime (Unix-Timestamp), used to calculate time of execution.

_getMicroTime() : float
Inherited
inherited_from \cOutputCache::_getMicroTime()

Returns

floatTimestamp

Creates one-time a instance of PEAR cache output object and also the unique id, if propery $this->_oPearCache is not set.

_initFileCache() : void
Inherited
inherited_from \cOutputCache::_initFileCache()

Checks, if the create code flag is set.

_isCode2Create(mixed $iCreateCode) : bool

Output will be loaded from cache, if no code is 2 create. It also checks the state of global variable $force.

Parameters

$iCreateCode

mixed

State of create code (0 or 1). The state will be loaded from database if value is "null"

Returns

boolTrue if code is to create, otherwhise false.

Raises any defined event code by using eval().

_raiseEvent(string $name) : void
Inherited
inherited_from \cOutputCache::_raiseEvent()

Parameters

$name

string

Name of event 2 raise

Starts the cache process.

_start() : bool | string
Inherited
inherited_from \cOutputCache::_start()

Returns

boolstring

 Properties

 

$_aCacheOptions : array
Inherited
inherited_from \cOutputCache::$$_aCacheOptions
 

$_aEventCode : array
Inherited

We have actually two hooks: - 'beforeoutput': code to execute before doing the output - 'afteroutput' code to execute after output

inherited_from \cOutputCache::$$_aEventCode
 

$_aIDOptions : array
Inherited

g. $_GET,$_POST, $_COOKIE, ...).

inherited_from \cOutputCache::$$_aIDOptions
 

$_bDebug : bool
Inherited
inherited_from \cOutputCache::$$_bDebug
 

$_bEnableCaching : bool
Inherited
inherited_from \cOutputCache::$$_bEnableCaching
 

$_bHtmlComment : bool
Inherited
inherited_from \cOutputCache::$$_bHtmlComment
 

$_fileCache : \cFileCache
Inherited
inherited_from \cOutputCache::$$_fileCache
 

$_iLifetime : int
Inherited
inherited_from \cOutputCache::$$_iLifetime
 

$_iStartTime : int
Inherited
inherited_from \cOutputCache::$$_iStartTime
 

$_sDebugMsg : string
Inherited
inherited_from \cOutputCache::$$_sDebugMsg
 

$_sDebugTpl : string
Inherited
inherited_from \cOutputCache::$$_sDebugTpl
 

$_sDir : string
Inherited
inherited_from \cOutputCache::$$_sDir
 

$_sGroup : string
Inherited
inherited_from \cOutputCache::$$_sGroup
 

$_sHtmlCommentTpl : string
Inherited
inherited_from \cOutputCache::$$_sHtmlCommentTpl
 

$_sID : string
Inherited
inherited_from \cOutputCache::$$_sID
 

$_sPrefix : string
Inherited
inherited_from \cOutputCache::$$_sPrefix