cms\includes\class.concache.php

Show: PublicProtectedPrivateinherited
Table of Contents
Project: Contenido Content Management System

Description:

Requirements:

Author
Murat Purc  
Brief
Class cConCache. Handles the "PEAR Cache Output" functionality.  
Class
cConCache  
Con_php_req
5  
Copyright
four for business AG  
Date
2006-07-07 {@internal created 2006-07-07 modified 2008-07-03, bilal arslan, added security fix $Id: class.concache.php 739 2008-08-27 10:37:54Z timo.trautmann $: }}  
Deprecated
file deprecated in contenido release  
File
class.concache.php  
License
http://www.contenido.org/license/LIZENZ.txt  
Link
http://www.4fb.de  
Link
http://www.contenido.org  
Package
Contenido Backend  
Since
file available since contenido release  
Version
0.9  

\cConCache

Package: Default
Children
\cConCacheHandler

Properties

>VPropertypublicarray $_aCacheOptions
Option array 4 pear caching.
Details
Type
array
>VPropertypublicarray $_aEventCode
Handler array 2 store code, beeing executed on some events.

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

Details
Type
array
>VPropertypublicarray $_aIDOptions
Option array 4 generating cache identifier (e.

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

Details
Type
array
>VPropertypublicbool $_bDebug = false
Flag for output of debug informations.
Default valuefalseDetails
Type
bool
>VPropertypublicbool $_bEnableCaching = false
Flag 2 activate caching.
Default valuefalseDetails
Type
bool
>VPropertypublicbool $_bHtmlComment = false
Flag 2 print html comment including some debug informations.
Default valuefalseDetails
Type
bool
>VPropertypublicint $_iLifetime = 3600
Default lifetime of cached files.
Default value3600Details
Type
int
>VPropertypublicint $_iStartTime
Start time of caching.
Details
Type
int
>VPropertypublic\obj $_oPearCache
PEAR Cache Output Object
Details
Type
\obj
>VPropertypublicstring $_sDebugMsg = ''
Used 2 store debug message.
Default value''Details
Type
string
>VPropertypublicstring $_sDebugTpl = '<div>%s</div>'
HTML code template used for debug message.
Default value'<div>%s</div>'Details
Type
string
>VPropertypublicstring $_sDir = 'cache/'
Directory 2 store cached output.
Default value'cache/'Details
Type
string
>VPropertypublicstring $_sGroup = 'default'
Subdirectory 2 store cached output.
Default value'default'Details
Type
string
>VPropertypublicstring $_sHtmlCommentTpl = ' <!-- CACHESTATE: %s TIME: %s VALID UNTIL: %s --> '
HTML comment template used for generating some debug infos.
Default value' <!-- CACHESTATE: %s TIME: %s VALID UNTIL: %s --> 'Details
Type
string
>VPropertypublicstring $_sID
Unique identifier for caching.
Details
Type
string
>VPropertypublicstring $_sPrefix = 'cache_'
Substring 2 add as prefix to cache-filename.
Default value'cache_'Details
Type
string

Methods

methodpublic_getMicroTime() : float

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

Returns
TypeDescription
floatTimestamp
Details
Access
private  
methodpublic_initPEARCache() : void

methodpublic_raiseEvent(string $name) : void

Raises any defined event code by using eval().

Parameters
NameTypeDescription
$namestring

Name of event 2 raise

Details
Access
private  
methodpublicaddOption(string $name, string $option) : void

Add option 4 caching (e.

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

Parameters
NameTypeDescription
$namestring

Name of option

$optionstring

Value of option (any variable)

methodpubliccConCache(string $cachedir = null, string $cachegroup = null, string $cacheprefix = null) : void

Constructor of cConCache

Parameters
NameTypeDescription
$cachedirstring

Directory 2 cache files

$cachegroupstring

Subdirectory 2 cache files

$cacheprefixstring

Prefixname 2 add 2 cached files

methodpublicdebug(bool $debug) : mixed

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

Parameters
NameTypeDescription
$debugbool

True 2 activate debugging or false.

Returns
TypeDescription
mixedDebug flag or void
methodpublicenable(bool $enable = null) : mixed

Set/Get the flag 2 enable caching.

Parameters
NameTypeDescription
$enablebool

True 2 enable chaching or false

Returns
TypeDescription
mixedEnable flag or void
methodpublicend() : void

Handles ending of PEAR caching.

methodpublicgetInfo() : string

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

Returns
TypeDescription
stringInformation about cache if caching is enabled, otherwhise nothing.
methodpublichtmlComment(bool $htmlcomment) : void

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

Parameters
NameTypeDescription
$htmlcommentbool

True debugging or false.

methodpublicinfoTemplate(string $template) : void

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

Parameters
NameTypeDescription
$templatestring

Template string including the '%s' format definition.

methodpubliclifetime(int $seconds = null) : mixed

Set/Get caching lifetime in seconds.

Parameters
NameTypeDescription
$secondsint

New Lifetime in seconds

Returns
TypeDescription
mixedActual lifetime or void
methodpublicremoveFromCache() : void

Removes any cached content if exists.

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

methodpublicstart(int $iPageStartTime = null) : void

Handles PEAR caching.

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

Parameters
NameTypeDescription
$iPageStartTimeint

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

\cConCacheHandler

Package: Default
Parent(s)
\cConCache

Properties

>VPropertypublicarray $_aCacheOptions
inherited
Option array 4 pear caching.
Inherited from: \cConCache::$$_aCacheOptions
Details
Type
array
Inherited_from
\cConCache::$$_aCacheOptions  
>VPropertypublicarray $_aEventCode
inherited
Handler array 2 store code, beeing executed on some events.
Inherited from: \cConCache::$$_aEventCode

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

Details
Type
array
Inherited_from
\cConCache::$$_aEventCode  
>VPropertypublicarray $_aIDOptions
inherited
Option array 4 generating cache identifier (e.
Inherited from: \cConCache::$$_aIDOptions

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

Details
Type
array
Inherited_from
\cConCache::$$_aIDOptions  
>VPropertypublicbool $_bDebug = false
inherited
Flag for output of debug informations.
Inherited from: \cConCache::$$_bDebug
Default valuefalseDetails
Type
bool
Inherited_from
\cConCache::$$_bDebug  
>VPropertypublicbool $_bEnableCaching = false
inherited
Flag 2 activate caching.
Inherited from: \cConCache::$$_bEnableCaching
Default valuefalseDetails
Type
bool
Inherited_from
\cConCache::$$_bEnableCaching  
>VPropertypublicbool $_bHtmlComment = false
inherited
Flag 2 print html comment including some debug informations.
Inherited from: \cConCache::$$_bHtmlComment
Default valuefalseDetails
Type
bool
Inherited_from
\cConCache::$$_bHtmlComment  
>VPropertypublicint $_iLifetime = 3600
inherited
Default lifetime of cached files.
Inherited from: \cConCache::$$_iLifetime
Default value3600Details
Type
int
Inherited_from
\cConCache::$$_iLifetime  
>VPropertypublicint $_iStartTime
inherited
Start time of caching.
Inherited from: \cConCache::$$_iStartTime
Details
Type
int
Inherited_from
\cConCache::$$_iStartTime  
>VPropertypublic\obj $_oPearCache
inherited
PEAR Cache Output Object
Inherited from: \cConCache::$$_oPearCache
Details
Type
\obj
Inherited_from
\cConCache::$$_oPearCache  
>VPropertypublicstring $_sDebugMsg = ''
inherited
Used 2 store debug message.
Inherited from: \cConCache::$$_sDebugMsg
Default value''Details
Type
string
Inherited_from
\cConCache::$$_sDebugMsg  
>VPropertypublicstring $_sDebugTpl = '<div>%s</div>'
inherited
HTML code template used for debug message.
Inherited from: \cConCache::$$_sDebugTpl
Default value'<div>%s</div>'Details
Type
string
Inherited_from
\cConCache::$$_sDebugTpl  
>VPropertypublicstring $_sDir = 'cache/'
inherited
Directory 2 store cached output.
Inherited from: \cConCache::$$_sDir
Default value'cache/'Details
Type
string
Inherited_from
\cConCache::$$_sDir  
>VPropertypublicstring $_sGroup = 'default'
inherited
Subdirectory 2 store cached output.
Inherited from: \cConCache::$$_sGroup
Default value'default'Details
Type
string
Inherited_from
\cConCache::$$_sGroup  
>VPropertypublicstring $_sHtmlCommentTpl = ' <!-- CACHESTATE: %s TIME: %s VALID UNTIL: %s --> '
inherited
HTML comment template used for generating some debug infos.
Inherited from: \cConCache::$$_sHtmlCommentTpl
Default value' <!-- CACHESTATE: %s TIME: %s VALID UNTIL: %s --> 'Details
Type
string
Inherited_from
\cConCache::$$_sHtmlCommentTpl  
>VPropertypublicstring $_sID
inherited
Unique identifier for caching.
Inherited from: \cConCache::$$_sID
Details
Type
string
Inherited_from
\cConCache::$$_sID  
>VPropertypublicstring $_sPrefix = 'cache_'
inherited
Substring 2 add as prefix to cache-filename.
Inherited from: \cConCache::$$_sPrefix
Default value'cache_'Details
Type
string
Inherited_from
\cConCache::$$_sPrefix  

Methods

methodpublic_getMicroTime() : float
inherited

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

Inherited from: \cConCache::_getMicroTime()
Returns
TypeDescription
floatTimestamp
Details
Access
private  
methodpublic_initPEARCache() : void
inherited

Inherited from: \cConCache::_initPEARCache()
methodpublic_isCode2Create(mixed $iCreateCode) : bool

Checks, if the create code flag is set.

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

Parameters
NameTypeDescription
$iCreateCodemixed

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

Returns
TypeDescription
boolTrue if code is to create, otherwhise false.
Details
Access
private  
methodpublic_raiseEvent(string $name) : void
inherited

Raises any defined event code by using eval().

Inherited from: \cConCache::_raiseEvent()
Parameters
NameTypeDescription
$namestring

Name of event 2 raise

Details
Access
private  
methodpublicaddOption(string $name, string $option) : void
inherited

Add option 4 caching (e.

Inherited from: \cConCache::addOption()

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

Parameters
NameTypeDescription
$namestring

Name of option

$optionstring

Value of option (any variable)

methodpubliccConCache(string $cachedir = null, string $cachegroup = null, string $cacheprefix = null) : void
inherited

Constructor of cConCache

Inherited from: \cConCache::cConCache()
Parameters
NameTypeDescription
$cachedirstring

Directory 2 cache files

$cachegroupstring

Subdirectory 2 cache files

$cacheprefixstring

Prefixname 2 add 2 cached files

methodpubliccConCacheHandler(array $aConf, \obj $db, int $iCreateCode = null) : void

Constructor of cConCacheHandler.

Does some checks and sets the configuration of cache object.

Parameters
NameTypeDescription
$aConfarray

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\obj

Reference 2 Contenido database object

$iCreateCodeint

Flag of createcode state from table con_cat_art

methodpublicdebug(bool $debug) : mixed
inherited

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

Inherited from: \cConCache::debug()
Parameters
NameTypeDescription
$debugbool

True 2 activate debugging or false.

Returns
TypeDescription
mixedDebug flag or void
methodpublicenable(bool $enable = null) : mixed
inherited

Set/Get the flag 2 enable caching.

Inherited from: \cConCache::enable()
Parameters
NameTypeDescription
$enablebool

True 2 enable chaching or false

Returns
TypeDescription
mixedEnable flag or void
methodpublicend() : void
inherited

Handles ending of PEAR caching.

Inherited from: \cConCache::end()
methodpublicgetInfo() : string
inherited

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

Inherited from: \cConCache::getInfo()
Returns
TypeDescription
stringInformation about cache if caching is enabled, otherwhise nothing.
methodpublichtmlComment(bool $htmlcomment) : void
inherited

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

Inherited from: \cConCache::htmlComment()
Parameters
NameTypeDescription
$htmlcommentbool

True debugging or false.

methodpublicinfoTemplate(string $template) : void
inherited

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

Inherited from: \cConCache::infoTemplate()
Parameters
NameTypeDescription
$templatestring

Template string including the '%s' format definition.

methodpubliclifetime(int $seconds = null) : mixed
inherited

Set/Get caching lifetime in seconds.

Inherited from: \cConCache::lifetime()
Parameters
NameTypeDescription
$secondsint

New Lifetime in seconds

Returns
TypeDescription
mixedActual lifetime or void
methodpublicremoveFromCache() : void
inherited

Removes any cached content if exists.

Inherited from: \cConCache::removeFromCache()

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

methodpublicstart(int $iPageStartTime = null) : void
inherited

Handles PEAR caching.

Inherited from: \cConCache::start()

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

Parameters
NameTypeDescription
$iPageStartTimeint

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

Documentation was generated by phpDocumentor 2.0.0a12.