Snc\RedisBundle\Session\Storage\Handler\RedisSessionHandler::write PHP Method

write() public method

public write ( $sessionId, $data )
    public function write($sessionId, $data)
    {
        if (0 < $this->ttl) {
            $this->redis->setex($this->getRedisKey($sessionId), $this->ttl, $data);
        } else {
            $this->redis->set($this->getRedisKey($sessionId), $data);
        }
        return true;
    }

Usage Example

 public function testWritingSessionDataWithExpiration()
 {
     $this->redis->expects($this->once())->method('set')->with($this->equalTo('session:_symfony'), $this->equalTo('some data'));
     $this->redis->expects($this->once())->method('expire')->with($this->equalTo('session:_symfony'), $this->equalTo(10));
     $handler = new RedisSessionHandler($this->redis, array('cookie_lifetime' => 10), 'session');
     $handler->write('_symfony', 'some data');
 }
All Usage Examples Of Snc\RedisBundle\Session\Storage\Handler\RedisSessionHandler::write