當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Dict::InCache方法代碼示例

本文整理匯總了PHP中Dict::InCache方法的典型用法代碼示例。如果您正苦於以下問題:PHP Dict::InCache方法的具體用法?PHP Dict::InCache怎麽用?PHP Dict::InCache使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Dict的用法示例。


在下文中一共展示了Dict::InCache方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: LoadConfig

 public static function LoadConfig($oConfiguration, $bAllowCache = false)
 {
     self::$m_oConfig = $oConfiguration;
     // Set log ASAP
     if (self::$m_oConfig->GetLogGlobal()) {
         if (self::$m_oConfig->GetLogIssue()) {
             self::$m_bLogIssue = true;
             IssueLog::Enable(APPROOT . 'log/error.log');
         }
         self::$m_bLogNotification = self::$m_oConfig->GetLogNotification();
         self::$m_bLogWebService = self::$m_oConfig->GetLogWebService();
         ToolsLog::Enable(APPROOT . 'log/tools.log');
     } else {
         self::$m_bLogIssue = false;
         self::$m_bLogNotification = false;
         self::$m_bLogWebService = false;
     }
     ExecutionKPI::EnableDuration(self::$m_oConfig->Get('log_kpi_duration'));
     ExecutionKPI::EnableMemory(self::$m_oConfig->Get('log_kpi_memory'));
     ExecutionKPI::SetAllowedUser(self::$m_oConfig->Get('log_kpi_user_id'));
     self::$m_bSkipCheckToWrite = self::$m_oConfig->Get('skip_check_to_write');
     self::$m_bSkipCheckExtKeys = self::$m_oConfig->Get('skip_check_ext_keys');
     self::$m_bUseAPCCache = $bAllowCache && self::$m_oConfig->Get('apc_cache.enabled') && function_exists('apc_fetch') && function_exists('apc_store');
     DBSearch::EnableQueryCache(self::$m_oConfig->GetQueryCacheEnabled(), self::$m_bUseAPCCache, self::$m_oConfig->Get('apc_cache.query_ttl'));
     DBSearch::EnableQueryTrace(self::$m_oConfig->GetLogQueries());
     DBSearch::EnableQueryIndentation(self::$m_oConfig->Get('query_indentation_enabled'));
     DBSearch::EnableOptimizeQuery(self::$m_oConfig->Get('query_optimization_enabled'));
     // PHP timezone first...
     //
     $sPHPTimezone = self::$m_oConfig->Get('timezone');
     if ($sPHPTimezone == '') {
         // Leave as is... up to the admin to set a value somewhere...
         //$sPHPTimezone = date_default_timezone_get();
     } else {
         date_default_timezone_set($sPHPTimezone);
     }
     // Note: load the dictionary as soon as possible, because it might be
     //       needed when some error occur
     $sAppIdentity = 'itop-' . MetaModel::GetEnvironmentId();
     $bDictInitializedFromData = false;
     if (!self::$m_bUseAPCCache || !Dict::InCache($sAppIdentity)) {
         $bDictInitializedFromData = true;
         foreach (self::$m_oConfig->GetDictionaries() as $sModule => $sToInclude) {
             self::IncludeModule('dictionaries', $sToInclude);
         }
     }
     // Set the language... after the dictionaries have been loaded!
     Dict::SetDefaultLanguage(self::$m_oConfig->GetDefaultLanguage());
     // Romain: this is the only way I've found to cope with the fact that
     //         classes have to be derived from cmdbabstract (to be editable in the UI)
     require_once APPROOT . '/application/cmdbabstract.class.inc.php';
     foreach (self::$m_oConfig->GetAppModules() as $sModule => $sToInclude) {
         self::IncludeModule('application', $sToInclude);
     }
     foreach (self::$m_oConfig->GetDataModels() as $sModule => $sToInclude) {
         self::IncludeModule('business', $sToInclude);
     }
     foreach (self::$m_oConfig->GetWebServiceCategories() as $sModule => $sToInclude) {
         self::IncludeModule('webservice', $sToInclude);
     }
     foreach (self::$m_oConfig->GetAddons() as $sModule => $sToInclude) {
         self::IncludeModule('addons', $sToInclude);
     }
     $sServer = self::$m_oConfig->GetDBHost();
     $sUser = self::$m_oConfig->GetDBUser();
     $sPwd = self::$m_oConfig->GetDBPwd();
     $sSource = self::$m_oConfig->GetDBName();
     $sTablePrefix = self::$m_oConfig->GetDBSubname();
     $sCharacterSet = self::$m_oConfig->GetDBCharacterSet();
     $sCollation = self::$m_oConfig->GetDBCollation();
     if (self::$m_bUseAPCCache) {
         $oKPI = new ExecutionKPI();
         // Note: For versions of APC older than 3.0.17, fetch() accepts only one parameter
         //
         $sOqlAPCCacheId = 'itop-' . MetaModel::GetEnvironmentId() . '-metamodel';
         $result = apc_fetch($sOqlAPCCacheId);
         if (is_array($result)) {
             // todo - verifier que toutes les classes mentionnees ici sont chargees dans InitClasses()
             self::$m_aExtensionClasses = $result['m_aExtensionClasses'];
             self::$m_Category2Class = $result['m_Category2Class'];
             self::$m_aRootClasses = $result['m_aRootClasses'];
             self::$m_aParentClasses = $result['m_aParentClasses'];
             self::$m_aChildClasses = $result['m_aChildClasses'];
             self::$m_aClassParams = $result['m_aClassParams'];
             self::$m_aAttribDefs = $result['m_aAttribDefs'];
             self::$m_aAttribOrigins = $result['m_aAttribOrigins'];
             self::$m_aExtKeyFriends = $result['m_aExtKeyFriends'];
             self::$m_aIgnoredAttributes = $result['m_aIgnoredAttributes'];
             self::$m_aFilterDefs = $result['m_aFilterDefs'];
             self::$m_aFilterOrigins = $result['m_aFilterOrigins'];
             self::$m_aListInfos = $result['m_aListInfos'];
             self::$m_aListData = $result['m_aListData'];
             self::$m_aRelationInfos = $result['m_aRelationInfos'];
             self::$m_aStates = $result['m_aStates'];
             self::$m_aStimuli = $result['m_aStimuli'];
             self::$m_aTransitions = $result['m_aTransitions'];
             self::$m_aHighlightScales = $result['m_aHighlightScales'];
         }
         $oKPI->ComputeAndReport('Metamodel APC (fetch + read)');
     }
//.........這裏部分代碼省略.........
開發者ID:henryavila,項目名稱:itop,代碼行數:101,代碼來源:metamodel.class.php


注:本文中的Dict::InCache方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。