/**
  * 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;
 }
Exemple #2
0
 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));
 }