public function iGetNewTimeID($sKind) { $aPara = array('kind' => $sKind); $ret = $this->_oProxy->invoke('newTimeId', $aPara); KO_DEBUG >= 2 && Ko_Tool_Debug::VAddTmpLog('data/IDMan', 'newTimeId:' . $sKind . ':' . $ret['id']); return $ret['id']; }
private static function _SGetCaller() { if (is_null(self::$s_sCaller)) { self::$s_sCaller = sprintf('%s:%s:%08x', Ko_Tool_Module::SGetScriptFullName(), Ko_Tool_Ip::SGetServerIp(), mt_rand()); KO_DEBUG >= 5 && Ko_Tool_Debug::VAddTmpLog('data/KProxy', '_SGetCaller_Create:' . self::$s_sCaller); } return self::$s_sCaller; }
public function vClearKind() { KO_DEBUG >= 2 && Ko_Tool_Debug::VAddTmpLog('data/UObjectMan', 'clearKind:' . $this->_sKind); try { $aPara = array('kind' => $this->_sKind); $this->_oProxy->invoke('clearKind', $aPara); } catch (Exception $ex) { } }
private function _aQuery($sKind, $iHintId, $vSql, $iCacheTime = 0, $bMaster = false) { if (is_array($vSql)) { KO_DEBUG >= 1 && Ko_Tool_Debug::VAddTmpLog('data/SqlAgent', 'M:' . $sKind . ':' . $iHintId . ':' . $iCacheTime . ':' . implode(':', $vSql)); $ret = $this->_oGetEngine()->aMultiQuery($sKind, $iHintId, $vSql, $iCacheTime, $bMaster); } else { KO_DEBUG >= 1 && Ko_Tool_Debug::VAddTmpLog('data/SqlAgent', 'S:' . $sKind . ':' . $iHintId . ':' . $iCacheTime . ':' . $vSql); $ret = $this->_oGetEngine()->aSingleQuery($sKind, $iHintId, $vSql, $iCacheTime, $bMaster); } return $ret; }
protected function __construct($sTag, $sRedisHost) { KO_DEBUG >= 6 && Ko_Tool_Debug::VAddTmpLog('data/Redis', '__construct:' . $sTag); if (!strlen($sRedisHost)) { $sRedisHost = KO_REDIS_HOST; } list($host, $port) = explode(':', $sRedisHost); $this->_oRedis = new Redis(); if (!$this->_oRedis->connect($host, $port)) { $this->_oRedis = null; } }
private function _aFormatResult($oSqlRes) { $data = array(); $insertId = isset($oSqlRes['insertId']) ? intval($oSqlRes['insertId']) : 0; $affectedRowNumber = isset($oSqlRes['affectedRowNumber']) ? intval($oSqlRes['affectedRowNumber']) : 0; if (isset($oSqlRes['rows'])) { $rownum = count($oSqlRes['rows']); foreach ($oSqlRes['rows'] as $i => $row) { $array = array(); foreach ($oSqlRes['fields'] as $id => $field) { $array[$field] = is_object($row[$id]) ? strval($row[$id]) : $row[$id]; } $data[$i] = $array; } } else { $rownum = 0; } KO_DEBUG >= 7 && Ko_Tool_Debug::VAddTmpLog('data/DBMan', '_aFormatResult:insertid_' . $insertId . ':affectedrows_' . $affectedRowNumber . ':rownum_' . $rownum); return array('data' => $data, 'rownum' => $rownum, 'insertid' => $insertId, 'affectedrows' => $affectedRowNumber); }
protected function __construct($sTag) { KO_DEBUG >= 6 && Ko_Tool_Debug::VAddTmpLog('data/RedisK', '__construct:' . $sTag); parent::__construct('Redis', $sTag); }
private function _aGet($vHintId, $aKey, $bOnlyFromInProcCache) { $sCacheKey = $this->_sGetCacheKey($vHintId, $aKey); $aRet = $this->_oGetDBCache()->vGet($sCacheKey, !$bOnlyFromInProcCache); KO_DEBUG >= 1 && !$bOnlyFromInProcCache && Ko_Tool_Debug::VAddTmpLog('stat/aGet', $aRet !== false ? 'cache' : 'miss'); if ($aRet !== false) { return $aRet; } if ($bOnlyFromInProcCache) { return array(); } $oOption = $this->_oCreateOption(); $oOption = $this->_vBuildOption($oOption, $vHintId, $aKey); $oOption->oLimit(1); $aRet = $this->_oGetSqlAgent()->aSelect($this->_sTable, $this->iGetHintId($vHintId), $oOption, 0, true); $aRet = empty($aRet) ? array() : $aRet[0]; $this->_oGetDBCache()->vSet($sCacheKey, $aRet, true); return $aRet; }
public function iPlus($sKey, $iValue, $iExpire) { KO_DEBUG >= 2 && Ko_Tool_Debug::VAddTmpLog('data/LCache', 'plus:' . $sKey . ':' . $iValue . ':' . $iExpire); try { $aPara = array('key' => $sKey, 'value' => intval($iValue), 'expire' => intval($iExpire)); $ret = $this->_oProxy->invoke('plus', $aPara); return $ret['value']; } catch (Exception $ex) { return false; } }
private function _vCheckInProcMem() { if (count(self::$s_aCache) > self::CHECK_MEM_COUNT) { self::$s_aCache = array(); KO_DEBUG >= 5 && Ko_Tool_Debug::VAddTmpLog('data/DBCache', '_vCheckInProcMem_Clear'); } }
protected function __construct() { KO_DEBUG >= 6 && Ko_Tool_Debug::VAddTmpLog('data/DLog', '__construct'); parent::__construct('DLog'); }
public function vInvalidate($iUid, $iId) { KO_DEBUG >= 2 && Ko_Tool_Debug::VAddTmpLog('data/UObjectMysql', 'invalidateComplex:' . $this->_sKind . ':' . $this->_sSplitField . ':' . $this->_sKeyField . ':' . $iUid . ':' . $iId); }
public function iDecrement($sKey, $iValue = 1) { KO_DEBUG >= 2 && Ko_Tool_Debug::VAddTmpLog('data/MemCache', 'decrement:' . $sKey . ':' . $iValue); if ($this->_oMemcache) { return $this->_oMemcache->decrement($sKey, $iValue); } return false; }
public function aStatAllServers() { KO_DEBUG >= 2 && Ko_Tool_Debug::VAddTmpLog('data/MCache', 'statAllServers'); try { $aPara = array(); $ret = $this->_oProxy->invoke('statAllServers', $aPara); return $ret; } catch (Exception $ex) { return false; } }
protected function __construct() { KO_DEBUG >= 6 && Ko_Tool_Debug::VAddTmpLog('data/Keyword', '__construct'); parent::__construct('KeywordMan'); }