コード例 #1
0
ファイル: RuntimeTest.php プロジェクト: cargomedia/cm
 public function testDeleteExpired()
 {
     CMTest_TH::timeInit();
     $runtime = new CM_Cache_Storage_Runtime();
     $runtime->set('foo', true);
     $this->assertTrue($runtime->get('foo'));
     CMTest_TH::timeForward(5);
     $runtime->set('bar', true);
     $this->assertFalse($runtime->get('foo'));
 }
コード例 #2
0
ファイル: Runtime.php プロジェクト: cargomedia/cm
 /**
  * @return CM_Cache_Storage_Runtime
  */
 public static function getInstance()
 {
     if (!self::$_instance) {
         self::$_instance = new self();
     }
     return self::$_instance;
 }
コード例 #3
0
ファイル: JobWorker.php プロジェクト: cargomedia/cm
 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');
         }
     }
 }
コード例 #4
0
ファイル: File.php プロジェクト: NicolasSchmutz/cm
 /**
  * @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());
 }
コード例 #5
0
ファイル: Abstract.php プロジェクト: NicolasSchmutz/cm
 public function __construct()
 {
     $this->_runtime = CM_Cache_Storage_Runtime::getInstance();
 }