31 function &
getInstance($target =
'object', $info = null, $always_use_file =
false)
33 $cache_handler_key = $target . ($always_use_file ?
'_file' :
'');
34 if(!
$GLOBALS[
'__XE_CACHE_HANDLER__'][$cache_handler_key])
36 $GLOBALS[
'__XE_CACHE_HANDLER__'][$cache_handler_key] =
new CacheHandler($target, $info, $always_use_file);
38 return $GLOBALS[
'__XE_CACHE_HANDLER__'][$cache_handler_key];
52 function __construct($target, $info = null, $always_use_file =
false)
61 if($target ==
'object')
63 if($info->use_object_cache ==
'apc')
67 else if(substr($info->use_object_cache, 0, 8) ==
'memcache')
70 $url = $info->use_object_cache;
72 else if($info->use_object_cache ==
'wincache')
76 else if($info->use_object_cache ==
'file')
80 else if($always_use_file)
85 else if($target ==
'template')
87 if($info->use_template_cache ==
'apc')
91 else if(substr($info->use_template_cache, 0, 8) ==
'memcache')
94 $url = $info->use_template_cache;
96 else if($info->use_template_cache ==
'wincache')
104 $class =
'Cache' . ucfirst($type);
105 include_once sprintf(
'%sclasses/cache/%s.class.php',
_XE_PATH_, $class);
106 $this->handler = call_user_func(array($class,
'getInstance'), $url);
107 $this->keyGroupVersions = $this->handler->get(
'key_group_versions', 0);
108 if(!$this->keyGroupVersions)
110 $this->keyGroupVersions = array();
111 $this->handler->put(
'key_group_versions', $this->keyGroupVersions, 0);
124 if($this->handler && $this->handler->isSupport())
140 $key = str_replace(
'/',
':', $key);
153 function get($key, $modified_time = 0)
162 return $this->handler->get($key, $modified_time);
177 if(!$this->handler && !$key)
184 return $this->handler->put($key,
$obj, $valid_time);
193 function delete($key)
202 return $this->handler->delete($key);
222 return $this->handler->isValid($key, $modified_time);
237 return $this->handler->truncate();
258 if(!$this->keyGroupVersions[$keyGroupName])
260 $this->keyGroupVersions[$keyGroupName] = 1;
261 $this->handler->put(
'key_group_versions', $this->keyGroupVersions, 0);
264 return 'cache_group_' . $this->keyGroupVersions[$keyGroupName] .
':' . $keyGroupName .
':' . $key;
275 $this->keyGroupVersions[$keyGroupName]++;
276 $this->handler->put(
'key_group_versions', $this->keyGroupVersions, 0);
302 function get($key, $modified_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']
& getInstance($target= 'object', $info=null, $always_use_file=false)
__construct($target, $info=null, $always_use_file=false)
invalidateGroupKey($keyGroupName)
put($key, $obj, $valid_time=0)
isValid($key, $modified_time=0)
put($key, $obj, $valid_time=0)
isValid($key, $modified_time=0)
getGroupKey($keyGroupName, $key)