コード例 #1
0
ファイル: DoctrineSaveHandler.php プロジェクト: rexmac/zyndax
 /**
  * Garbage Collection - remove session data older than $maxlifetime
  *
  * @param  int $maxlifetime Lifetime (in seconds)
  * @return bool
  */
 public function gc($maxlifetime)
 {
     SessionService::collectGarbage($maxlifetime);
     return true;
 }
コード例 #2
0
ファイル: SessionServiceTest.php プロジェクト: rexmac/zyndax
 public function testGarbageCollection()
 {
     $testSession = SessionTest::createOldTestSession();
     SessionService::create($testSession);
     $sessions = self::$entityManager->createQuery('SELECT e FROM ' . SessionService::getEntityClass() . ' e')->execute();
     $this->assertEquals(1, count($sessions));
     SessionService::collectGarbage(0);
     $sessions = self::$entityManager->createQuery('SELECT e FROM ' . SessionService::getEntityClass() . ' e')->execute();
     $this->assertEquals(0, count($sessions));
 }