コード例 #1
0
ファイル: HiWrapper.php プロジェクト: cjp2600/hiwrapper
 /**
  * _getHlTablesList
  * @param bool $refresh_cache
  * @return bool
  * @throws \Bitrix\Main\ArgumentException
  */
 private function getHlTablesList($refresh_cache = false)
 {
     if (is_null(self::$_hlblock_list)) {
         $cache = new \CPHPCache();
         $cache_time = $this->getDefaultCacheTime();
         $cache_id = 'getHlTablesList';
         $cache_path = '/' . __CLASS__ . '/' . __METHOD__ . '/';
         if (!$refresh_cache && $cache->InitCache($cache_time, $cache_id, $cache_path)) {
             self::$_hlblock_list = $cache->GetVars();
         } else {
             $cache->StartDataCache($cache_time, $cache_id, $cache_path);
             $dbItems = HighloadBlockTable::GetList(array('select' => array('ID', 'NAME', 'TABLE_NAME')));
             while ($arItem = $dbItems->Fetch()) {
                 self::$_hlblock_list[strtoupper($arItem['NAME'])] = $arItem;
             }
             if (is_null(self::$_hlblock_list)) {
                 $cache->AbortDataCache();
             }
             $cache->EndDataCache(self::$_hlblock_list);
         }
     }
     return self::$_hlblock_list;
 }