Mage_Core_Model_Resource_Session::write PHP Method

write() public method

Update session
public write ( string $sessId, string $sessData ) : boolean
$sessId string
$sessData string
return boolean
    public function write($sessId, $sessData)
    {
        $bindValues = array('session_id' => $sessId);
        $select = $this->_write->select()->from($this->_sessionTable)->where('session_id = :session_id');
        $exists = $this->_read->fetchOne($select, $bindValues);
        $bind = array('session_expires' => Varien_Date::toTimestamp(true) + $this->getLifeTime(), 'session_data' => $sessData);
        if ($exists) {
            $where = array('session_id=?' => $sessId);
            $this->_write->update($this->_sessionTable, $bind, $where);
        } else {
            $bind['session_id'] = $sessId;
            $this->_write->insert($this->_sessionTable, $bind);
        }
        return true;
    }

Usage Example

Exemplo n.º 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'));
 }
All Usage Examples Of Mage_Core_Model_Resource_Session::write