Cheetah
ChWsbCacheOPcache.php
Go to the documentation of this file.
1 <?php
2 
8 ch_import('ChWsbCache');
9 
11 {
12  //var $iTTL = 3600;
13  //var $iStoreFlag = 0;
14  //var $oOPcache = null;
15 
17  var $bOpcacheGetStatusAva = false;
20 
24  function __construct()
25  {
26  parent::__construct();
27 
28 
29  //if (class_exists('OPcache')) {
30  // $this->oOPcache = new OPcache();
31  //if (!$this->oOPcache->connect (getParam('sys_cache_OPcache_host'), getParam('sys_cache_OPcache_port')))
32  // $this->oOPcache = null;
33  //}
34 
35  $this -> bOpcacheGetConfigurationAva = function_exists('opcache_get_configuration');
36  $this -> bOpcacheGetStatusAva = function_exists('opcache_get_status');
37 
38  $s = ini_get('disable_functions');
39 
40  if(strpos($s, 'opcache_get_status') === false) {
41  $this -> bOpcacheGetStatusDisabled = false;
42  } else {
43  $this -> bOpcacheGetStatusDisabled = true;
44  }
45 
46  if(strpos($s, 'opcache_get_configuration') === false) {
47  $this -> bOpcacheGetConfigurationDisabled = false;
48  } else {
49  $this -> bOpcacheGetConfigurationDisabled = true;
50  }
51 
52  //echo $s;
53  //exit;
54 
55  }
56 
64  function getData($sKey, $iTTL = false)
65  {
66  //$mixedData = $this->oOPcache->get($sKey);
67  //return false === $mixedData ? null : $mixedData;
68  }
69 
78  function setData($sKey, $mixedData, $iTTL = false)
79  {
80  //return $this->oOPcache->set($sKey, $mixedData, $this->iStoreFlag, false === $iTTL ? $this->iTTL : $iTTL);
81  }
82 
89  function delData($sKey)
90  {
91  //$this->oOPcache->delete($sKey);
92  //return true;
93  }
94 
99  function isAvailable()
100  {
101 
102  //$r = @opcache_get_status();
103  //echo '<pre>' . print_r($r, true) . '</pre>';
104  //exit;
105 
106  return $this -> bOpcacheGetConfigurationAva;
107  }
108 
113  function isInstalled()
114  {
115  if($this -> bOpcacheGetConfigurationAva) {
116  $r = @opcache_get_configuration();
117  return $r['directives']['opcache.enable'];
118  }
119  }
120 
126  {
127  // not implemented for current cache
128  return false;
129  }
130 
134  function getSizeByPrefix ($s)
135  {
136  // not implemented for current cache
137  return false;
138  }
139 }
ChWsbCacheOPcache\getSizeByPrefix
getSizeByPrefix($s)
Definition: ChWsbCacheOPcache.php:134
ChWsbCacheOPcache\delData
delData($sKey)
Definition: ChWsbCacheOPcache.php:89
ChWsbCacheOPcache\$bOpcacheGetConfigurationDisabled
$bOpcacheGetConfigurationDisabled
Definition: ChWsbCacheOPcache.php:18
ChWsbCacheOPcache
Definition: ChWsbCacheOPcache.php:11
ChWsbCacheOPcache\removeAllByPrefix
removeAllByPrefix($s)
Definition: ChWsbCacheOPcache.php:125
ch_import
ch_import($sClassName, $aModule=array())
Definition: utils.inc.php:1218
php
ChWsbCache
Definition: ChWsbCache.php:9
ChWsbCacheOPcache\setData
setData($sKey, $mixedData, $iTTL=false)
Definition: ChWsbCacheOPcache.php:78
ChWsbCacheOPcache\$bOpcacheGetConfigurationAva
$bOpcacheGetConfigurationAva
Definition: ChWsbCacheOPcache.php:16
ChWsbCacheOPcache\isAvailable
isAvailable()
Definition: ChWsbCacheOPcache.php:99
ChWsbCacheOPcache\getData
getData($sKey, $iTTL=false)
Definition: ChWsbCacheOPcache.php:64
ChWsbCacheOPcache\__construct
__construct()
Definition: ChWsbCacheOPcache.php:24
$s
$s
Definition: embed.php:13
ChWsbCacheOPcache\$bOpcacheGetStatusDisabled
$bOpcacheGetStatusDisabled
Definition: ChWsbCacheOPcache.php:19
ChWsbCacheOPcache\isInstalled
isInstalled()
Definition: ChWsbCacheOPcache.php:113
ChWsbCacheOPcache\$bOpcacheGetStatusAva
$bOpcacheGetStatusAva
Definition: ChWsbCacheOPcache.php:17