Cheetah
ChWsbCacheMemcache.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 $oMemcache = null;
15 
19  function __construct()
20  {
21  parent::__construct();
22 
23  if (class_exists('Memcache')) {
24  $this->oMemcache = new Memcache();
25  if (!$this->oMemcache->connect (getParam('sys_cache_memcache_host'), getParam('sys_cache_memcache_port')))
26  $this->oMemcache = null;
27  }
28  }
29 
37  function getData($sKey, $iTTL = false)
38  {
39  $mixedData = $this->oMemcache->get($sKey);
40  return false === $mixedData ? null : $mixedData;
41  }
42 
51  function setData($sKey, $mixedData, $iTTL = false)
52  {
53  return $this->oMemcache->set($sKey, $mixedData, $this->iStoreFlag, false === $iTTL ? $this->iTTL : $iTTL);
54  }
55 
62  function delData($sKey)
63  {
64  $this->oMemcache->delete($sKey);
65  return true;
66  }
67 
72  function isAvailable()
73  {
74  return $this->oMemcache == null ? false : true;
75  }
76 
81  function isInstalled()
82  {
83  return extension_loaded('memcache');
84  }
85 
90  function removeAllByPrefix ($s)
91  {
92  // not implemented for current cache
93  return false;
94  }
95 
99  function getSizeByPrefix ($s)
100  {
101  // not implemented for current cache
102  return false;
103  }
104 }
ChWsbCacheMemcache\isInstalled
isInstalled()
Definition: ChWsbCacheMemcache.php:81
ChWsbCacheMemcache\__construct
__construct()
Definition: ChWsbCacheMemcache.php:19
ChWsbCacheMemcache\$iTTL
$iTTL
Definition: ChWsbCacheMemcache.php:12
ch_import
ch_import($sClassName, $aModule=array())
Definition: utils.inc.php:1218
php
null
Attr AllowedClasses this is null
Definition: Attr.AllowedClasses.txt:6
ChWsbCacheMemcache\isAvailable
isAvailable()
Definition: ChWsbCacheMemcache.php:72
ChWsbCacheMemcache\setData
setData($sKey, $mixedData, $iTTL=false)
Definition: ChWsbCacheMemcache.php:51
ChWsbCacheMemcache\getSizeByPrefix
getSizeByPrefix($s)
Definition: ChWsbCacheMemcache.php:99
ChWsbCache
Definition: ChWsbCache.php:9
ChWsbCacheMemcache\$oMemcache
$oMemcache
Definition: ChWsbCacheMemcache.php:14
getParam
getParam($sParamName, $bUseCache=true)
Definition: db.inc.php:130
ChWsbCacheMemcache\getData
getData($sKey, $iTTL=false)
Definition: ChWsbCacheMemcache.php:37
ChWsbCacheMemcache\$iStoreFlag
$iStoreFlag
Definition: ChWsbCacheMemcache.php:13
$s
$s
Definition: embed.php:13
ChWsbCacheMemcache\delData
delData($sKey)
Definition: ChWsbCacheMemcache.php:62
ChWsbCacheMemcache
Definition: ChWsbCacheMemcache.php:11
false
if(!defined("FALSE_VAL")) define("FALSE_VAL" false
Definition: constants.inc.php:9
ChWsbCacheMemcache\removeAllByPrefix
removeAllByPrefix($s)
Definition: ChWsbCacheMemcache.php:90