コード例 #1
0
 public function testGC()
 {
     $this->rediska->set('s_123', 'aaa');
     $this->rediska->addToSet('s_sessions', '123');
     $reply = $this->saveHandler->gc(0);
     $this->assertTrue($reply);
     $values = $this->rediska->getSet('s_sessions');
     $this->assertEquals(array('123'), $values);
     $value = $this->rediska->get('s_123');
     $this->assertEquals('aaa', $value);
     $this->rediska->delete('s_123');
     $reply = $this->saveHandler->gc(0);
     $this->assertTrue($reply);
     $values = $this->rediska->getSet('s_sessions');
     $this->assertEquals(array(), $values);
 }
コード例 #2
0
ファイル: SessionTest.php プロジェクト: r-kovalenko/Rediska
 public function testGC()
 {
     $this->saveHandler->write('123', 123);
     $reply = $this->saveHandler->gc(null);
     $this->assertEquals(0, $reply);
     $this->saveHandler->setOption('lifetime', 1);
     $this->saveHandler->write('123', 123);
     sleep(2);
     $reply = $this->saveHandler->gc(null);
     $this->assertEquals(1, $reply);
     $values = $this->rediska->getSortedSet('s_sessions');
     $this->assertEquals(array(), $values);
 }