/** * @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."); } }
/** * Purge all cache system wide * * @param Array|Garp_Model_Db $tags * @param Boolean $createClusterJob Whether this purge should create a job to clear the other * nodes in this server cluster, if applicable. * @param String $cacheDir Directory which stores static HTML cache files. * @return Void */ public static function purge($tags = array(), $createClusterJob = true, $cacheDir = false) { if ($tags instanceof Garp_Model_Db) { $tags = self::getTagsFromModel($tags); } self::purgeStaticCache($tags, $cacheDir); self::purgeMemcachedCache($tags); $ini = Zend_Registry::get('config'); if ($createClusterJob && $ini->app->clusteredHosting) { Garp_Cache_Store_Cluster::createJob($tags); } }