This class contains functions for the output cache in CONTENIDO.

package Core
subpackage Cache

 Methods

Constructor of cOutputCache

__construct(string $cachedir, string $cachegroup, string $cacheprefix) 

Parameters

$cachedir

string

Directory 2 cache files

$cachegroup

string

Subdirectory 2 cache files

$cacheprefix

string

Prefixname 2 add 2 cached files

Add option 4 caching (e.

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

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

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

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

Parameters

$enable

bool

True 2 enable caching or false

Returns

mixedEnable flag or void

Handles ending of PEAR caching.

end() : void

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

getInfo() : string

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

Parameters

$htmlcomment

bool

True debugging or false.

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

infoTemplate(string $template) : void

Parameters

$template

string

Template string including the '%s' format definition.

Set/Get caching lifetime in seconds.

lifetime(int $seconds) : mixed

Parameters

$seconds

int

New Lifetime in seconds

Returns

mixedActual lifetime or void

Removes any cached content if exists.

removeFromCache() : void

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

Handles PEAR caching.

start(int $iPageStartTime) : void

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

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

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

Raises any defined event code by using eval().

_raiseEvent(string $name) : void

Parameters

$name

string

Name of event 2 raise

Starts the cache process.

_start() : bool | string

Returns

boolstring

 Properties

 

$_aCacheOptions : array
 

$_aEventCode : array

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

 

$_aIDOptions : array

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

 

$_bDebug : bool
 

$_bEnableCaching : bool
 

$_bHtmlComment : bool
 

$_fileCache : \cFileCache
 

$_iLifetime : int
 

$_iStartTime : int
 

$_sDebugMsg : string
 

$_sDebugTpl : string
 

$_sDir : string
 

$_sGroup : string
 

$_sHtmlCommentTpl : string
 

$_sID : string
 

$_sPrefix : string