Cheetah
ChWsbCacheFileHtml.php
Go to the documentation of this file.
1 <?php
2 
8 require_once(CH_DIRECTORY_PATH_CLASSES . 'ChWsbCacheFile.php');
9 
10 class ChWsbCacheFileHtml extends ChWsbCacheFile
11 {
15  function __construct()
16  {
17  parent::__construct();
18  }
19 
27  function getData($sKey, $iTTL = false)
28  {
29  if(!file_exists($this->sPath . $sKey))
30  return null;
31 
32  if ($iTTL > 0 && $this->_removeFileIfTtlExpired ($this->sPath . $sKey, $iTTL))
33  return null;
34 
35  return file_get_contents($this->sPath . $sKey);
36  }
37 
41  function getDataFilePath($sKey, $iTTL = false)
42  {
43  if (!file_exists($this->sPath . $sKey))
44  return null;
45 
46  if ($iTTL > 0 && $this->_removeFileIfTtlExpired ($this->sPath . $sKey, $iTTL))
47  return null;
48 
49  return $this->sPath . $sKey;
50  }
51 
60  function setData($sKey, $mixedData, $iTTL = false)
61  {
62  if(file_exists($this->sPath . $sKey) && !is_writable($this->sPath . $sKey))
63  return false;
64 
65  if(!($rHandler = fopen($this->sPath . $sKey, 'w')))
66  return false;
67 
68  fwrite($rHandler, $mixedData);
69  fclose($rHandler);
70  @chmod($this->sPath . $sKey, 0666);
71 
72  return true;
73  }
74 }
ChWsbCacheFileHtml\getDataFilePath
getDataFilePath($sKey, $iTTL=false)
Definition: ChWsbCacheFileHtml.php:41
php
ChWsbCacheFileHtml\__construct
__construct()
Definition: ChWsbCacheFileHtml.php:15
ChWsbCacheFileHtml\setData
setData($sKey, $mixedData, $iTTL=false)
Definition: ChWsbCacheFileHtml.php:60
ChWsbCacheFileHtml
Definition: ChWsbCacheFileHtml.php:11
ChWsbCacheFileHtml\getData
getData($sKey, $iTTL=false)
Definition: ChWsbCacheFileHtml.php:27