本文整理汇总了PHP中CacheManager::instance方法的典型用法代码示例。如果您正苦于以下问题:PHP CacheManager::instance方法的具体用法?PHP CacheManager::instance怎么用?PHP CacheManager::instance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CacheManager
的用法示例。
在下文中一共展示了CacheManager::instance方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: init
public static function init()
{
#-------------------------------------------------------------------------------
if (self::$instance === NULL) {
#-------------------------------------------------------------------------------
try {
#-------------------------------------------------------------------------------
Debug("[system/classes/auto/CacheManager.class.php]: Start initializing cache system.");
#-------------------------------------------------------------------------------
if (Extension_Loaded(MemcachedCache::EXT_NAME) && File_Exists(SPrintF('%s/.memcached', SYSTEM_PATH))) {
#-------------------------------------------------------------------------------
Debug('[system/classes/auto/CacheManager.class.php]: Force load MemcachedCache');
#-------------------------------------------------------------------------------
self::$instance = MemcachedCache::getInstance();
#-------------------------------------------------------------------------------
} else {
if (Extension_Loaded(APCCache::EXT_NAME)) {
#-------------------------------------------------------------------------------
Debug('[system/classes/auto/CacheManager.class.php]: Load APCCache');
#-------------------------------------------------------------------------------
self::$instance = APCCache::getInstance();
#-------------------------------------------------------------------------------
} else {
if (Extension_Loaded(MemcachedCache::EXT_NAME)) {
#-------------------------------------------------------------------------------
Debug('[system/classes/auto/CacheManager.class.php]: Load MemcachedCache');
#-------------------------------------------------------------------------------
self::$instance = MemcachedCache::getInstance();
#-------------------------------------------------------------------------------
} else {
#-------------------------------------------------------------------------------
throw new Exception("Any supported cache not installed in your sysytem.");
}
}
}
#-------------------------------------------------------------------------------
Debug("Cache system has been initialized.");
#-------------------------------------------------------------------------------
} catch (Exception $e) {
#-------------------------------------------------------------------------------
Debug("Cache system has not been installed: " . $e->getTraceAsString());
#-------------------------------------------------------------------------------
}
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
}
#-------------------------------------------------------------------------------
return self::$instance;
#-------------------------------------------------------------------------------
}