close ()

Close a session from writing

Part of the standard PHP session handler interface

Access

public

Returns

Type

Description

boolean

Success

Source

Method defined in extensions/dynamodbsessionhandler.class.php | Toggle source view (22 lines) | View on GitHub

public function close()
{
    if (!$this->_session_written)
    {
        // Ensure that the session is unlocked even if the write did not happen
        $id = $this->_open_session;
        $response = $this->_dynamodb->update_item(array(
            'TableName'        => $this->_table_name,
            'Key'              => array('HashKeyElement' => $this->_dynamodb->attribute($this->_id($id))),
            'AttributeUpdates' => array(
                'expires'  => $this->_dynamodb->attribute(time() + $this->_session_lifetime, 'update'),
                'lock'     => array('Action' => AmazonDynamoDB::ACTION_DELETE)
            ),
        ));

        $this->_session_written = $response->isOK();
    }

    $this->_open_session = null;

    return $this->_session_written;
}

Copyright © 2010–2013 Amazon Web Services, LLC


Feedback