Esempio n. 1
0
 /**
  * @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
  */
 public function executeDueJobs($serverId, $lastCheckIn)
 {
     //  if the last check-in was more than two hours ago, first clear the cache.
     if (time() - strtotime($lastCheckIn) > 60 * 60 * 2) {
         Garp_Cache_Manager::purge(array(), false);
         $this->clearedTags = array();
     } else {
         $clusterClearCacheJobModel = new Model_ClusterClearCacheJob();
         $jobs = $clusterClearCacheJobModel->fetchDue($serverId, $lastCheckIn);
         if (count($jobs)) {
             if ($this->_containsGeneralClearJob($jobs)) {
                 Garp_Cache_Manager::purge(array(), false);
                 $this->clearedTags = array();
             } else {
                 $tags = $this->_getTagsFromJobs($jobs);
                 Garp_Cache_Manager::purge($tags, false);
                 $this->clearedTags = $tags;
             }
         } else {
             $this->clearedTags = false;
         }
     }
 }