首页 / PHP / beanstalk的使用有关问题
beanstalk的使用有关问题
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了beanstalk的使用有关问题,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含1998字,纯文字阅读大概需要3分钟。
内容图文
![beanstalk的使用有关问题](/upload/InfoBanner/zyjiaocheng/230/443ecedf38ea4068b1f342f0634eb2a2.jpg)
require_once(realpath(dirname(__FILE__)).'/../pheanstalk/pheanstalk_init.php');
class AppRemoteLib {
var $beanhost = false;
var $beanport = false;
var $beanhandle = false;
function openqueue($host, $port) {
if ($this->beanhost || $this->beanport) return false;
$this->beanhost = $host;
$this->beanport = $port;
$this->beanhandle = new Pheanstalk($host, $port);
if (!$this->beanhandle) return false;
return true;
}
public function putrequest()
{
try {
$this->beanhandle->useTube('test');
$jobid = $this->beanhandle->put('some data', 1000, 0,1 );
} catch (Exception $e) {
$jobid = false;
}
return $jobid;
}
public function fetch($tube, $timeout=0) {
try {
$this->beanhandle->watch($tube);
$job = $this->beanhandle->reserve($timeout);
} catch (Exception $e) {
return false;
}
if (!$job) return false;
var_dump($job);
sleep(10);
try {
$this->beanhandle->delete($job);
} catch (Exception $e) {
return false;
}
return $job;
}
private function watch($tube) {
$this->beanhandle->watch($tube);
}
private function fetchall($timeout=0) {
try {
$job = $this->beanhandle->reserve($timeout);
if (!$job) return false;
$this->beanhandle->delete($job);
} catch (Exception $e) {
}
return $job;
}
}
$appremotelib = new AppRemoteLib();
$appremotelib->openqueue("192.168.19.128", "11911");
$appremotelib->putrequest();
$job = $appremotelib->fetch('test', 2);
?>
问题是这样,资料上说put命令的tty参数的意思是
我设置put的tty的参数为1,$jobid = $this->beanhandle->put('some data', 1000, 0,1 );
并且在fetch函数中获取完成之后$job = $this->beanhandle->reserve($timeout); sleep(10);延迟了10秒才删除job,为什么我的job还是可以删除成功,不是应该这个job会超时吗?
------解决方案--------------------
超时就不执行,删除还是删除
内容总结
以上是互联网集市为您收集整理的beanstalk的使用有关问题全部内容,希望文章能够帮你解决beanstalk的使用有关问题所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。
来源:【匿名】