destroy ( $id, $garbage_collect_mode )

Delete a session stored in DynamoDB.

Part of the standard PHP session handler interface.

Access

public

Parameters

Parameter

Type

Required

Description

$id

string

Required

The session ID.

$garbage_collect_mode

boolean

Optional

Whether or not the handler is doing garbage collection.

Returns

Type

Description

boolean

Whether or not the operation succeeded.

Source

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

public function destroy($id, $garbage_collect_mode = false)
{
    // Make sure we don't prefix the ID a second time
    if (!$garbage_collect_mode)
    {
        $id = $this->_id($id);
    }

    $delete_options = array(
        'TableName' => $this->_table_name,
        'Key'       => array('HashKeyElement' => $this->_dynamodb->attribute($id)),
    );

    // Make sure not to garbage collect locked sessions
    if ($garbage_collect_mode && $this->_session_locking)
    {
        $delete_options['Expected'] = array('lock' => array('Exists' => false));
    }

    // Send the delete request to DynamoDB
    $response = $this->_dynamodb->delete_item($delete_options);

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

    return $this->_session_written;
}

Copyright © 2010–2013 Amazon Web Services, LLC


Feedback