コード例 #1
0
ファイル: Cluster.php プロジェクト: grrr-amsterdam/garp3
 /**
  * @param Int $serverId Database id of the current server in the cluster
  * @param String $lastCheckIn MySQL datetime that represents
  *                            the last check-in time of this server
  * @return void
  */
 protected function _runCacheClearJobs($serverId, $lastCheckIn)
 {
     try {
         $cluster = new Garp_Cache_Store_Cluster();
         $cluster->executeDueJobs($serverId, $lastCheckIn);
     } catch (Exception $e) {
         throw new Exception('Error during execution of cluster clear job. ' . $e->getMessage());
     }
     if (is_array($cluster->clearedTags)) {
         if (empty($cluster->clearedTags)) {
             Garp_Cli::lineOut('Clustered cache purged for all models.');
         } else {
             Garp_Cli::lineOut('Clustered cache purged for models ' . implode(', ', $cluster->clearedTags));
         }
     } elseif (is_bool($cluster->clearedTags) && !$cluster->clearedTags) {
         Garp_Cli::lineOut('No clustered cache purge jobs to run.');
     } else {
         throw new Exception("Error in clearing clustered cache.");
     }
 }