Created
December 30, 2013 14:59
-
-
Save ericsk/8183051 to your computer and use it in GitHub Desktop.
WindowsAzureSessionHandler 的建構與解構函式
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Session handler constructor. | |
* | |
* @param $storageAccountName The Windows Azure Table Services account name. | |
* @param $storageAccountKey The Windows Azure Table Service account key. | |
* @param $sessionContainer The name of the table for storing session data. | |
* @param $sessionContainerParition The name of the partition for storing session data. | |
*/ | |
public function __construct($storageAccountName, $storageAccountKey, $sessionContainer = 'phpsessions', $sessionContainerPartition = 'sessions') { | |
// create the conneciton string for creating the table service rest proxy intance. | |
$connectionString = "DefaultEndpointsProtocol=https;AccountName=" . | |
$storageAccountName . | |
";AccountKey=" . | |
$storageAccountKey; | |
// create the table service instance. | |
$this->_tableRestProxy = ServiceBuilder::getInstance()->createTableService($connectionString); | |
// set up the table and partition names. | |
$this->_sessionContainer = $sessionContainer; | |
$this->_sessionContainerPartition = $sessionContainerPartition; | |
// register the session shutdown function. | |
register_shutdown_function('session_write_close'); | |
} | |
/** | |
* Destructor. | |
*/ | |
public function __destruct() { | |
session_write_close(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment