8 require_once(CH_DIRECTORY_PATH_CLASSES .
'ChWsbCache.php');
19 parent::__construct();
21 $this->sPath = CH_DIRECTORY_PATH_DBCACHE;
31 function getData($sKey, $iTTL =
false)
33 if (!file_exists($this->sPath . $sKey))
36 if ($iTTL > 0 && $this->_removeFileIfTtlExpired ($this->sPath . $sKey, $iTTL))
39 include($this->sPath . $sKey);
51 function setData($sKey, $mixedData, $iTTL =
false)
53 if(file_exists($this->sPath . $sKey) && !is_writable($this->sPath . $sKey))
56 if(!($rHandler = fopen($this->sPath . $sKey,
'w')))
59 fwrite($rHandler,
'<?php $mixedData=' . var_export($mixedData,
true) .
'; ?>');
61 @chmod($this->sPath . $sKey, 0666);
74 $sFile = $this->sPath . $sKey;
84 if (!($rHandler = opendir($this->sPath)))
88 while ((
$sFile = readdir($rHandler)) !==
false)
90 @unlink ($this->sPath .
$sFile);
102 if (!($rHandler = opendir($this->sPath)))
107 while ((
$sFile = readdir($rHandler)) !==
false)
109 $iSize += @filesize ($this->sPath .
$sFile);
122 function _removeFileIfTtlExpired (
$sFile, $iTTL)
125 if ($iTimeDiff > $iTTL) {