public function updateMatchByFan($params)
 {
     // Default response
     $response = NULL;
     try {
         // Get config application
         $config = Thethao_Global::getApplicationIni();
         // Get team_match object
         $matchMysqlObj = $this->factory('Match', $config['database']['default']['adapter']);
         // Get match infos fan
         $arrMatchFan = $matchMysqlObj->getFanByMatch($params['matchId']);
         //Update
         if (isset($arrMatchFan['match_id']) && is_numeric($arrMatchFan['match_id']) && $arrMatchFan['match_id'] > 0) {
             if ($params['likeType'] == 0) {
                 $score = -1;
             } else {
                 $score = 1;
             }
             // Params update
             $paramUpdate = array('matchId' => $params['matchId'], 'fanteam_1' => $params['fanLikeTeam'] == 1 ? $arrMatchFan['fan_team1'] + $score : $arrMatchFan['fan_team1'], 'fanteam_2' => $params['fanLikeTeam'] == 2 ? $arrMatchFan['fan_team2'] + $score : $arrMatchFan['fan_team2']);
             if ($matchMysqlObj->updateMatchByFan($paramUpdate)) {
                 $keyCache = Thethao_Global::makeCacheKey(Thethao_Model_Match::EURO2012_MATCH_LIKE, array($params['matchId']));
                 Thethao_Global::deleteMemcache(array($keyCache));
             }
             //end if
         }
         //end if
     } catch (Exception $ex) {
         Thethao_Global::sendLog($ex);
     }
     return $response;
 }
Exemple #2
0
 /**
  * Clear cache top player
  * @param array $params
  * @return array
  * @author QuangTM
  */
 public function clearCacheTopPlayer($params)
 {
     // Get params
     $seasonID = $params['seasonID'];
     try {
         $keyCache = Thethao_Global::makeCacheKey(Thethao_Model_PlayerChampion::PLAYER_CHAMPION_BY_SEASON, $seasonID);
         Thethao_Global::deleteMemcache(array($keyCache));
     } catch (Exception $ex) {
         Thethao_Global::sendLog($ex);
     }
     return;
 }
 /**
  * @author      : HungNT
  * call job clear cache keybox fe
  * @todo        : clearCacheKeybox
  * @param type $arrParams
  */
 public function clearCacheKeybox($params)
 {
     // Delete cache
     $keyCache = Thethao_Global::makeCacheKey($params['key_id']);
     if (!$keyCache) {
         $keyCache = $params['key_id'];
     }
     Thethao_Global::deleteMemcache(array($keyCache));
     // Get player model
     $model = new Thethao_Model_Block();
     $arrReturn = $model->getKeyBox($params);
     //init news instance
     $caching = Thethao_Model_Caching::getInstance();
     $caching->clearCacheFile();
     //return
     return $arrReturn;
 }
Exemple #4
0
 /**
  * rewrite player champion
  * @param type $seasonId
  * @return array|boolean
  * @author PhongTX
  */
 public function rewritePlayerChampion($seasonId)
 {
     try {
         $keyCache = vsprintf($this->_player_champion_by_season, array($seasonId));
         //Delete memcache
         Thethao_Global::deleteMemcache(array($keyCache));
         $this->getListTopPlayers($seasonId);
     } catch (Exception $ex) {
         Thethao_Global::sendlog($ex, 1);
     }
 }
Exemple #5
0
 /**
  * function delete match
  * @param type $params
  */
 public function deleteMatch($params)
 {
     // Get params
     $matchDetail = $params['MatchDetail'];
     // Verify parameter
     if (is_array($matchDetail)) {
         $modelObject = Fpt_Data_Materials_Object::getInstance();
         $modelObject->getMatch()->updateObject($matchDetail['match_id']);
         $arrGmtTime = array(0, 7);
         $dateTimeHappenTemp = strtotime(date('d-m-Y', $matchDetail['datetime_happen'] + 25200));
         $arrKeyCache = array();
         foreach ($arrGmtTime as $gmt) {
             $arrKeyCache[] = vsprintf($this->_match_time_list, array($dateTimeHappenTemp, $matchDetail['league_id'], $gmt));
         }
         Thethao_Global::deleteMemcache($arrKeyCache);
         $keyCache1 = vsprintf($this->_match_team_season_league, array($matchDetail['team1'], $matchDetail['league_id'], $matchDetail['season_id']));
         $keyCache2 = vsprintf($this->_match_team_season_league, array($matchDetail['team2'], $matchDetail['league_id'], $matchDetail['season_id']));
         $keyCache3 = vsprintf($this->_match_statistic, array($matchDetail['match_id'], $matchDetail['team1']));
         $keyCache4 = vsprintf($this->_match_statistic, array($matchDetail['match_id'], $matchDetail['team2']));
         Thethao_Global::deleteMemcache(array($keyCache1, $keyCache2, $keyCache3, $keyCache4));
         //get app conf
         $config = Thethao_Global::getApplicationIni();
         $matchNosql = $this->factory('Match', $config['database']['nosql']['adapter']);
         $matchNosql->deleteMatchByLeague($matchDetail['league_id'], $matchDetail['match_id']);
     }
 }
Exemple #6
0
 /**
  * Rewrite table of football
  * @param array $params(LeagueID, SeasonID)
  */
 public function rewriteBXHCache($params)
 {
     // Get params
     $leagueID = intval($params['LeagueID']);
     $seasonID = intval($params['SeasonID']);
     // Make key cache from param
     $keyCache = vsprintf($this->_table_detail, array($leagueID, $seasonID));
     // Delete cache
     Thethao_Global::deleteMemcache(array($keyCache));
     // Re-write cache team_season
     return $this->getListTableRanking($seasonID, $leagueID);
 }
Exemple #7
0
 /**
  * clear cache CategoryFull
  * @return array
  * @author PhuongTN
  */
 public function editCategory()
 {
     //default response
     $response = array();
     //generate key cache
     $keyCache = vsprintf($this->_key_cache, array(SITE_ID));
     //delete memcache multi zone
     $response = Thethao_Global::deleteMemcache(array($keyCache), 'all');
     //precaching
     $this->getFullCategoryByParentId(true);
     //return response
     return $response;
 }
Exemple #8
0
 public function preCachingTennisMatch($params)
 {
     // Create key cache about tennis player
     $keyTennisMatch = vsprintf($this->_tennis_match_info, '');
     $arrKeyTennisMatch = $params['arrMatchIDs'];
     // Create array key cache
     array_walk($arrKeyTennisMatch, 'self::buildKeyCache', $keyTennisMatch);
     // Delete all cache
     $arrKeyCache = array();
     foreach ($arrKeyTennisMatch as $keyCache) {
         $arrKeyCache[] = $keyCache;
     }
     Thethao_Global::deleteMemcache($arrKeyCache);
     $chunkMatchIDs = array_chunk($params['arrMatchIDs'], 100);
     foreach ($chunkMatchIDs as $arrMatchIDs) {
         // Pre-Cache for tennis match
         $arrMatchInfo = $this->getTennisMatches($arrMatchIDs);
         // Push data into redis
         foreach ($arrMatchInfo as $matchInfo) {
             $this->insertTennisMatchIntoRedis($matchInfo);
         }
     }
     return TRUE;
 }