Mage_Core_Model_Resource_Session::gc PHP Метод

gc() публичный Метод

Garbage collection
public gc ( integer $sessMaxLifeTime ) : boolean
$sessMaxLifeTime integer ignored
Результат boolean
    public function gc($sessMaxLifeTime)
    {
        if ($this->_automaticCleaningFactor > 0) {
            if ($this->_automaticCleaningFactor == 1 || rand(1, $this->_automaticCleaningFactor) == 1) {
                $where = array('session_expires < ?' => Varien_Date::toTimestamp(true));
                $this->_write->delete($this->_sessionTable, $where);
            }
        }
        return true;
    }

Usage Example

Пример #1
0
 public function testGc()
 {
     $this->_model->write('test', 'test');
     $this->assertEquals('test', $this->_model->read('test'));
     $this->_model->gc(-1);
     $this->assertEmpty($this->_model->read('test'));
 }