/** * Gets the actual result when available. * If timeout is reached before actual result is redeemed, a TimeoutException will be thrown. * If the actual result is an Exception, that Exception will be thrown. * * @param $timeout * @return mixed * @throws TimeoutException * @throws */ public function get($timeout) { $blpop = redis()->blpop(self::RESULT . $this->asyncId, $timeout); if (isset($blpop[1])) { $this->result = crypto_unserialize($blpop[1]); } else { throw new TimeoutException(); } redis()->del(FUTURE_LOCK . $this->asyncId); // remove lock if ($this->result instanceof Exception) { throw $this->result; } return $this->result; }
function getSessionId() { return crypto_unserialize($this->sessionId); }