| class |
cConCacheHandler |
| brief |
Class cConCacheHandler. This is used to set configuration
and to manage caching output |
| version |
0.9 |
| date |
07.07.2006 |
| author |
Murat Purc |
| copyright |
© Murat Purc 2006 |
Methods
Returns microtime (Unix-Timestamp), used to calculate time of execution.
_getMicroTime() : float
Inherited
| access |
private |
| inherited_from |
\cConCache::_getMicroTime() |
Returns
floatTimestamp
_initPEARCache()
_initPEARCache()
Inherited
| inherited_from |
\cConCache::_initPEARCache() |
Checks, if the create code flag is set. Output will be loaded from cache, if no code is 2 create.
_isCode2Create(mixed $iCreateCode) : bool
It also checks the state of global variable $force.
Parameters
$iCreateCode
mixedState 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
| access |
private |
| inherited_from |
\cConCache::_raiseEvent() |
Parameters
$name
stringName of event 2 raise
Add option 4 caching (e. g. $_GET,$_POST, $_COOKIE, ...). Used 2 generate the id for caching.
addOption(string $name, string $option) : void
Inherited
| inherited_from |
\cConCache::addOption() |
Parameters
$name
stringName of option
$option
stringValue of option (any variable)
Constructor of cConCache
cConCache(string $cachedir, string $cachegroup, string $cacheprefix)
Inherited
| inherited_from |
\cConCache::cConCache() |
Parameters
$cachedir
stringDirectory 2 cache files
$cachegroup
stringSubdirectory 2 cache files
$cacheprefix
stringPrefixname 2 add 2 cached files
Constructor of cConCacheHandler.
cConCacheHandler(array $aConf, \obj $db, int $iCreateCode)
Does some checks and sets the configuration of cache object.
Parameters
$aConf
arrayConfiguration 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
\objReference 2 Contenido database object
$iCreateCode
intFlag of createcode state from table con_cat_art
Set/Get the flag 2 debug cache object (prints out miss/hit state with execution time).
debug(bool $debug) : mixed
Inherited
| inherited_from |
\cConCache::debug() |
Parameters
$debug
boolTrue 2 activate debugging or false.
Returns
mixedDebug flag or void
Set/Get the flag 2 enable caching.
enable(bool $enable) : mixed
Inherited
| inherited_from |
\cConCache::enable() |
Parameters
$enable
boolTrue 2 enable chaching or false
Returns
mixedEnable flag or void
Handles ending of PEAR caching.
end() : void
Inherited
| inherited_from |
\cConCache::end() |
Returns information cache hit/miss and execution time if caching is enabled.
getInfo() : string
Inherited
| inherited_from |
\cConCache::getInfo() |
Returns
stringInformation about cache if caching is enabled, otherwhise nothing.
Set/Get template to use on printing the chache info.
infoTemplate(string $template) : void
Inherited
| inherited_from |
\cConCache::infoTemplate() |
Parameters
$template
stringTemplate string including the '%s' format definition.
Set/Get caching lifetime in seconds.
lifetime(int $seconds) : mixed
Inherited
| inherited_from |
\cConCache::lifetime() |
Parameters
$seconds
intNew 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 |
\cConCache::removeFromCache() |
Handles PEAR caching. The script will be terminated by calling die(), if any cached
content is found.
start(int $iPageStartTime) : void
Inherited
| inherited_from |
\cConCache::start() |
Parameters
$iPageStartTime
intOptional start time, e. g. start time of main script
Properties
Option array 4 pear caching.
$_aCacheOptions : array
Inherited
| inherited_from |
\cConCache::$$_aCacheOptions |
Handler array 2 store code, beeing executed on some events.
$_aEventCode : array
Inherited
We have actually two events:
- 'beforeoutput': code to execute before doing the output
- 'afteroutput' code to execute after output
| inherited_from |
\cConCache::$$_aEventCode |
Option array 4 generating cache identifier (e. g. $_GET,$_POST, $_COOKIE, ...).
$_aIDOptions : array
Inherited
| inherited_from |
\cConCache::$$_aIDOptions |
Flag for output of debug informations.
$_bDebug : bool
Inherited
| inherited_from |
\cConCache::$$_bDebug |
Flag 2 activate caching.
$_bEnableCaching : bool
Inherited
| inherited_from |
\cConCache::$$_bEnableCaching |
Default lifetime of cached files.
$_iLifetime : int
Inherited
| inherited_from |
\cConCache::$$_iLifetime |
Start time of caching.
$_iStartTime : int
Inherited
| inherited_from |
\cConCache::$$_iStartTime |
PEAR Cache Output Object
$_oPearCache : \obj
Inherited
| inherited_from |
\cConCache::$$_oPearCache |
Used 2 store debug message.
$_sDebugMsg : string
Inherited
| inherited_from |
\cConCache::$$_sDebugMsg |
HTML code template used for debug message.
$_sDebugTpl : string
Inherited
| inherited_from |
\cConCache::$$_sDebugTpl |
Directory 2 store cached output.
$_sDir : string
Inherited
| inherited_from |
\cConCache::$$_sDir |
Subdirectory 2 store cached output.
$_sGroup : string
Inherited
| inherited_from |
\cConCache::$$_sGroup |
Unique identifier for caching.
$_sID : string
Inherited
| inherited_from |
\cConCache::$$_sID |
Substring 2 add as prefix to cache-filename.
$_sPrefix : string
Inherited
| inherited_from |
\cConCache::$$_sPrefix |