加入收藏 | 设为首页 | 会员中心 | 我要投稿 网站开发网_安阳站长网 (https://www.0518zz.com/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长百科 > 正文

php-beanstalkd消息队列类实例分享

发布时间:2021-01-28 13:24:41 所属栏目:站长百科 来源:网络整理
导读:副标题#e# 本文实例为大家分享了php beanstalkd消息队列类的具体代码,供大家参考,具体内容如下 use RuntimeException; /** An interface to the beanstalk queue service. Implements the beanstalk protocol spec 1.9. Where appropriate the documentat

/**

  • Inspect the job with the shortest delay left.
  • @return string|boolean false on error otherwise the body of the job.
    */
    public function peekDelayed() {
    $this->_write('peek-delayed');
    return $this->_peekRead();
    }

/**

  • Inspect the next job in the list of buried jobs.
  • @return string|boolean false on error otherwise the body of the job.
    */
    public function peekBuried() {
    $this->_write('peek-buried');
    return $this->_peekRead();
    }

/**

  • Handles response for all peek methods.
  • @return string|boolean false on error otherwise the body of the job.
    */
    protected function _peekRead() {
    $status = strtok($this->_read(),' ');
switch ($status) {
  case 'FOUND':
    return [
      'id' => (integer) strtok(' '),'body' => $this->_read((integer) strtok(' '))
    ];
  case 'NOT_FOUND':
  default:
    $this->_error($status);
    return false;
}

}

(编辑:网站开发网_安阳站长网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!