XpressEngine Core  1.11.2
 All Classes Namespaces Files Functions Variables Pages
CacheWincache.class.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) NAVER <http://www.navercorp.com> */
3 
11 class CacheWincache extends CacheBase
12 {
13  public static $isSupport = false;
14 
21  function getInstance($opt = null)
22  {
23  if(!$GLOBALS['__CacheWincache__'])
24  {
25  $GLOBALS['__CacheWincache__'] = new CacheWincache();
26  }
27  return $GLOBALS['__CacheWincache__'];
28  }
29 
35  function __construct()
36  {
37  }
38 
44  function isSupport()
45  {
46  return self::$isSupport;
47  }
48 
60  function put($key, $buff, $valid_time = 0)
61  {
62  if($valid_time == 0)
63  {
65  }
66  return wincache_ucache_set(md5(_XE_PATH_ . $key), array($_SERVER['REQUEST_TIME'], $buff), $valid_time);
67  }
68 
77  function isValid($key, $modified_time = 0)
78  {
79  $_key = md5(_XE_PATH_ . $key);
80  $obj = wincache_ucache_get($_key, $success);
81  if(!$success || !is_array($obj))
82  {
83  return false;
84  }
85  unset($obj[1]);
86 
87  if($modified_time > 0 && $modified_time > $obj[0])
88  {
89  $this->_delete($_key);
90  return false;
91  }
92 
93  return true;
94  }
95 
104  function get($key, $modified_time = 0)
105  {
106  $_key = md5(_XE_PATH_ . $key);
107  $obj = wincache_ucache_get($_key, $success);
108  if(!$success || !is_array($obj))
109  {
110  return false;
111  }
112 
113  if($modified_time > 0 && $modified_time > $obj[0])
114  {
115  $this->_delete($_key);
116  return false;
117  }
118 
119  return $obj[1];
120  }
121 
128  function _delete($_key)
129  {
130  wincache_ucache_delete($_key);
131  }
132 
139  function delete($key)
140  {
141  $_key = md5(_XE_PATH_ . $key);
142  $this->_delete($_key);
143  }
144 
150  function truncate()
151  {
152  return wincache_ucache_clear();
153  }
154 }
155 
156 CacheWincache::$isSupport = function_exists('wincache_ucache_set');
157 /* End of file CacheWincache.class.php */
158 /* Location: ./classes/cache/CacheWincache.class.php */
$obj
Definition: ko.install.php:262
put($key, $buff, $valid_time=0)
if(file_exists(_XE_PATH_. 'config/config.user.inc.php')) if(!defined('__DEBUG__')) if(!defined('__DEBUG_OUTPUT__')) if(!defined('__DEBUG_PROTECT__')) if(!defined('__DEBUG_PROTECT_IP__')) if(!defined('__DEBUG_DB_OUTPUT__')) if(!defined('__LOG_SLOW_QUERY__')) if(!defined('__LOG_SLOW_TRIGGER__')) if(!defined('__LOG_SLOW_ADDON__')) if(!defined('__LOG_SLOW_WIDGET__')) if(!defined('__DEBUG_QUERY__')) if(!defined('__OB_GZHANDLER_ENABLE__')) if(!defined('__ENABLE_PHPUNIT_TEST__')) if(!defined('__PROXY_SERVER__')) if(!defined('__ERROR_LOG__')) if(!defined('__DISABLE_DEFAULT_CSS__')) if(!defined('__AUTO_OPCACHE_INVALIDATE__')) if((__DEBUG_OUTPUT__==2)&&version_compare(PHP_VERSION, '6.0.0')===-1) if(version_compare(PHP_VERSION, '5.3.0') >=0) $GLOBALS['__xe_autoload_file_map']
Definition: config.inc.php:324
isValid($key, $modified_time=0)
const _XE_PATH_
Definition: config.inc.php:49
getInstance($opt=null)