public function testGc() { $prefix = $this->path . '/mocksess_'; $this->handler->write('1', 'data'); touch($prefix . '1', time() - 86400); $this->handler->write('2', 'data'); touch($prefix . '2', time() - 3600); $this->handler->write('3', 'data'); touch($prefix . '3', time() - 300); $this->handler->write('4', 'data'); $this->handler->gc(90000); $this->assertEquals(4, count(glob($this->path . '/*'))); $this->handler->gc(4000); $this->assertEquals(3, count(glob($this->path . '/*'))); $this->handler->gc(200); $this->assertEquals(1, count(glob($this->path . '/*'))); }
/** * Reads session from storage and loads session. */ private function read() { $data = $this->handler->read($this->id); $this->data = $data ? unserialize($data) : array(); $this->loadSession(); }