예제 #1
0
 /**
  * Read a specific session
  * 
  * @param int $id Session Id
  * @return string
  */
 public function read($id)
 {
     // Read data
     if ($this->_storageType == self::STORAGE_TYPE_TABLE) {
         // In table storage
         try {
             $sessionRecord = $this->_storage->retrieveEntityById($this->_sessionContainer, $this->_sessionContainerPartition, $id);
             return unserialize(base64_decode($sessionRecord->serializedData));
         } catch (Microsoft_WindowsAzure_Exception $ex) {
             return '';
         }
     } else {
         if ($this->_storageType == self::STORAGE_TYPE_BLOB) {
             // In blob storage
             try {
                 $data = $this->_storage->getBlobData($this->_sessionContainer, $this->_sessionContainerPartition . '/' . $id);
                 return unserialize(base64_decode($data));
             } catch (Microsoft_WindowsAzure_Exception $ex) {
                 return false;
             }
         }
     }
 }