public function run() { $jobsRun = 0; while (true) { if ($jobsRun >= $this->_jobLimit) { return; } $workFailed = false; try { $jobsRun++; CM_Cache_Storage_Runtime::getInstance()->flush(); $workFailed = !$this->_getGearmanWorker()->work(); } catch (Exception $ex) { $this->getServiceManager()->getLogger()->addMessage('Worker failed', CM_Log_Logger::exceptionToLevel($ex), (new CM_Log_Context())->setException($ex)); } if ($workFailed) { throw new CM_Exception_Invalid('Worker failed'); } } }
/** * @param bool|null $recursive */ public function delete($recursive = null) { if ($recursive) { $this->_filesystem->deleteByPrefix($this->getPath()); } $this->_filesystem->delete($this->getPath()); $cache = CM_Cache_Storage_Runtime::getInstance(); $cache->delete($this->_getCacheKeyContent()); }
public function __construct() { $this->_runtime = CM_Cache_Storage_Runtime::getInstance(); }