Thruway\Common\Utils::getUniqueId PHP Method

getUniqueId() public static method

Generate a unique id for sessions and requests
public static getUniqueId ( ) : mixed
return mixed
    public static function getUniqueId()
    {
        $filter = 0x1fffffffffffff;
        // 53 bits
        $randomBytes = openssl_random_pseudo_bytes(8);
        list($high, $low) = array_values(unpack("N2", $randomBytes));
        return abs(($high << 32 | $low) & $filter);
    }

Usage Example

示例#1
0
文件: Call.php 项目: binaek89/Thruway
 /**
  * Constructor
  *
  * @param \Thruway\Session $callerSession
  * @param \Thruway\Message\CallMessage $callMessage
  * @param Registration $registration
  */
 public function __construct(Session $callerSession, CallMessage $callMessage, Procedure $procedure)
 {
     $this->callMessage = $callMessage;
     $this->callerSession = $callerSession;
     $this->procedure = $procedure;
     $this->callStart = microtime(true);
     $this->invocationRequestId = Utils::getUniqueId();
 }
All Usage Examples Of Thruway\Common\Utils::getUniqueId