public static function &parseSql($sStatement, $sParserName = 'statement', $bReturnFirstTree = false) { $aCache = Cache::highSpeed(); $sSqlCacheKey = '/db/sql/raw/' . md5($sStatement); // 优先从缓存中查找 if (!($arrTrees = $aCache->item($sSqlCacheKey))) { if (!($arrTrees =& BaseParserFactory::singleton()->create(true, null, $sParserName)->parse($sStatement, $bReturnFirstTree))) { $null = null; return $null; } // 写入缓存 $aCache->setItem($sSqlCacheKey, $arrTrees); } return $arrTrees; }
/** * * @return ICache or null when cache didn't set */ public function cache() { return Cache::singleton(); }