本文整理匯總了PHP中vB_Cache::disableCache方法的典型用法代碼示例。如果您正苦於以下問題:PHP vB_Cache::disableCache方法的具體用法?PHP vB_Cache::disableCache怎麽用?PHP vB_Cache::disableCache使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類vB_Cache
的用法示例。
在下文中一共展示了vB_Cache::disableCache方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: instance
/**
* Returns an instance of the global cache.
* The cache type used is defined in options.
*
* @return vB_Cache - Reference to instance of the cache handler
*/
public static function instance($type = self::CACHE_STD)
{
$DEFAULTS_CACHETYPE = self::getDefaults();
$vb5_config =& vB::getConfig();
if (!empty($vb5_config['Misc']['debug']) and !empty($_REQUEST['nocache'])) {
self::$disableCache = 1;
}
if (!isset(self::$instance[$type])) {
if (!isset($vb5_config['Cache']) or !isset($vb5_config['Cache']['class']) or !is_array($vb5_config['Cache']['class']) or !isset($vb5_config['Cache']['class'][$type])) {
$cacheClass = $DEFAULTS_CACHETYPE[$type];
} else {
$cacheClass = $vb5_config['Cache']['class'][$type];
}
// if more than 1 of the 3 types (STD, FAST, LARGE) are using the same implementation,
// don't create a new instance, just share the same one.
foreach (array(self::CACHE_STD, self::CACHE_FAST, self::CACHE_LARGE) as $cacheType) {
if (!empty(self::$instance[$cacheType]) and is_a(self::$instance[$cacheType], $cacheClass)) {
self::$instance[$type] = self::$instance[$cacheType];
return self::$instance[$type];
}
}
// call constructor directly. Having static functions with the same name but different
// semantics in the subclasses works, but its tacky.
self::$instance[$type] = new $cacheClass($type);
//call_user_func(array($cacheClass, 'instance'));
vB_Shutdown::instance()->add(array(self::$instance[$type], 'shutdown'));
}
return self::$instance[$type];
}