cms\includes\class.concache.php
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
- Children
- \cConCacheHandler
Properties


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


array $_aIDOptions
g. $_GET,$_POST, $_COOKIE, ...).
- Type
- array


bool $_bHtmlComment = false
false
Details- Type
- bool


string $_sDebugTpl = '<div>%s</div>'
'<div>%s</div>'
Details- Type
- string


string $_sGroup = 'default'
'default'
Details- Type
- string


string $_sHtmlCommentTpl = '
<!--
CACHESTATE: %s
TIME: %s
VALID UNTIL: %s
-->
'
'
<!--
CACHESTATE: %s
TIME: %s
VALID UNTIL: %s
-->
'
Details- Type
- string
Methods


_getMicroTime() : float
Returns microtime (Unix-Timestamp), used to calculate time of execution.
Type | Description |
---|---|
float | Timestamp |
- Access
- private


_raiseEvent(string $name) : void
Raises any defined event code by using eval().
Name | Type | Description |
---|---|---|
$name | string | Name of event 2 raise |
- Access
- private


addOption(string $name, string $option) : void
Add option 4 caching (e.
g. $_GET,$_POST, $_COOKIE, ...). Used 2 generate the id for caching.
Name | Type | Description |
---|---|---|
$name | string | Name of option |
$option | string | Value of option (any variable) |


cConCache(string $cachedir = null, string $cachegroup = null, string $cacheprefix = null) : void
Constructor of cConCache
Name | Type | Description |
---|---|---|
$cachedir | string | Directory 2 cache files |
$cachegroup | string | Subdirectory 2 cache files |
$cacheprefix | string | Prefixname 2 add 2 cached files |


debug(bool $debug) : mixed
Set/Get the flag 2 debug cache object (prints out miss/hit state with execution time).
Name | Type | Description |
---|---|---|
$debug | bool | True 2 activate debugging or false. |
Type | Description |
---|---|
mixed | Debug flag or void |


enable(bool $enable = null) : mixed
Set/Get the flag 2 enable caching.
Name | Type | Description |
---|---|---|
$enable | bool | True 2 enable chaching or false |
Type | Description |
---|---|
mixed | Enable flag or void |


getInfo() : string
Returns information cache hit/miss and execution time if caching is enabled.
Type | Description |
---|---|
string | Information about cache if caching is enabled, otherwhise nothing. |


htmlComment(bool $htmlcomment) : void
Set/Get flag 2 print out cache info as html comment.
Name | Type | Description |
---|---|---|
$htmlcomment | bool | True debugging or false. |


infoTemplate(string $template) : void
Set/Get template to use on printing the chache info.
Name | Type | Description |
---|---|---|
$template | string | Template string including the '%s' format definition. |


lifetime(int $seconds = null) : mixed
Set/Get caching lifetime in seconds.
Name | Type | Description |
---|---|---|
$seconds | int | New Lifetime in seconds |
Type | Description |
---|---|
mixed | Actual lifetime or void |


removeFromCache() : void
Removes any cached content if exists.
This is nesessary to delete cached articles, if they are changed on backend.
\cConCacheHandler
- Parent(s)
- \cConCache
Properties


array $_aEventCode
We have actually two events: - 'beforeoutput': code to execute before doing the output - 'afteroutput' code to execute after output
- Type
- array
- Inherited_from
- \cConCache::$$_aEventCode


array $_aIDOptions
g. $_GET,$_POST, $_COOKIE, ...).
- Type
- array
- Inherited_from
- \cConCache::$$_aIDOptions


bool $_bEnableCaching = false
false
Details- Type
- bool
- Inherited_from
- \cConCache::$$_bEnableCaching


bool $_bHtmlComment = false
false
Details- Type
- bool
- Inherited_from
- \cConCache::$$_bHtmlComment


string $_sDebugTpl = '<div>%s</div>'
'<div>%s</div>'
Details- Type
- string
- Inherited_from
- \cConCache::$$_sDebugTpl


string $_sGroup = 'default'
'default'
Details- Type
- string
- Inherited_from
- \cConCache::$$_sGroup


string $_sHtmlCommentTpl = '
<!--
CACHESTATE: %s
TIME: %s
VALID UNTIL: %s
-->
'
'
<!--
CACHESTATE: %s
TIME: %s
VALID UNTIL: %s
-->
'
Details- Type
- string
- Inherited_from
- \cConCache::$$_sHtmlCommentTpl


string $_sPrefix = 'cache_'
'cache_'
Details- Type
- string
- Inherited_from
- \cConCache::$$_sPrefix
Methods


_getMicroTime() : float
Returns microtime (Unix-Timestamp), used to calculate time of execution.
Inherited from: \cConCache::_getMicroTime()Type | Description |
---|---|
float | Timestamp |
- Access
- private


_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.
Name | Type | Description |
---|---|---|
$iCreateCode | mixed | State of create code (0 or 1). The state will be loaded from database if value is "null" |
Type | Description |
---|---|
bool | True if code is to create, otherwhise false. |
- Access
- private


_raiseEvent(string $name) : void
Name | Type | Description |
---|---|---|
$name | string | Name of event 2 raise |
- Access
- private


addOption(string $name, string $option) : void
g. $_GET,$_POST, $_COOKIE, ...). Used 2 generate the id for caching.
Name | Type | Description |
---|---|---|
$name | string | Name of option |
$option | string | Value of option (any variable) |


cConCache(string $cachedir = null, string $cachegroup = null, string $cacheprefix = null) : void
Name | Type | Description |
---|---|---|
$cachedir | string | Directory 2 cache files |
$cachegroup | string | Subdirectory 2 cache files |
$cacheprefix | string | Prefixname 2 add 2 cached files |


cConCacheHandler(array $aConf, \obj $db, int $iCreateCode = null) : void
Constructor of cConCacheHandler.
Does some checks and sets the configuration of cache object.
Name | Type | Description |
---|---|---|
$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 | \obj | Reference 2 Contenido database object |
$iCreateCode | int | Flag of createcode state from table con_cat_art |


debug(bool $debug) : mixed
Set/Get the flag 2 debug cache object (prints out miss/hit state with execution time).
Inherited from: \cConCache::debug()Name | Type | Description |
---|---|---|
$debug | bool | True 2 activate debugging or false. |
Type | Description |
---|---|
mixed | Debug flag or void |


enable(bool $enable = null) : mixed
Name | Type | Description |
---|---|---|
$enable | bool | True 2 enable chaching or false |
Type | Description |
---|---|
mixed | Enable flag or void |


getInfo() : string
Returns information cache hit/miss and execution time if caching is enabled.
Inherited from: \cConCache::getInfo()Type | Description |
---|---|
string | Information about cache if caching is enabled, otherwhise nothing. |


htmlComment(bool $htmlcomment) : void
Set/Get flag 2 print out cache info as html comment.
Inherited from: \cConCache::htmlComment()Name | Type | Description |
---|---|---|
$htmlcomment | bool | True debugging or false. |


infoTemplate(string $template) : void
Set/Get template to use on printing the chache info.
Inherited from: \cConCache::infoTemplate()Name | Type | Description |
---|---|---|
$template | string | Template string including the '%s' format definition. |


lifetime(int $seconds = null) : mixed
Name | Type | Description |
---|---|---|
$seconds | int | New Lifetime in seconds |
Type | Description |
---|---|
mixed | Actual lifetime or void |


removeFromCache() : void
This is nesessary to delete cached articles, if they are changed on backend.