本文整理汇总了PHP中Resque::Redis方法的典型用法代码示例。如果您正苦于以下问题:PHP Resque::Redis方法的具体用法?PHP Resque::Redis怎么用?PHP Resque::Redis使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Resque
的用法示例。
在下文中一共展示了Resque::Redis方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: clearWorker
private function clearWorker()
{
\Resque::Redis()->del('ResqueWorker');
}
示例2: callCommand
/**
*
* @since 1.2.0
* @return void
*/
public function callCommand($command)
{
if (($settings = $this->loadSettings($command)) === false) {
exit(1);
}
$args = $this->input->getArguments();
$globalOptions = array('s' => 'host', 'p' => 'port', 'b' => 'path', 'c' => 'path', 'a' => 'path', 'd' => 'handler', 'r' => 'args,');
if ($command === null || !array_key_exists($command, $this->commandTree)) {
$this->help($command);
} else {
if ($this->input->getOption('help')->value === true) {
$this->output->outputLine();
$this->output->outputLine($this->commandTree[$command]['help']);
if (!empty($this->commandTree[$command]['options'])) {
$this->output->outputLine("\nAvailable options\n", 'subtitle');
foreach ($this->commandTree[$command]['options'] as $name => $arg) {
$opt = $this->input->getOption(is_numeric($name) ? $arg : $name);
$o = (!empty($opt->short) ? '-' . $opt->short : ' ') . ' ' . (is_numeric($name) ? '' : '<' . $arg . '>');
$this->output->outputLine(sprintf('%-15s --%-15s %s', $o, $opt->long, $opt->longhelp));
}
}
$this->output->outputLine("\nGlobal options\n", 'subtitle');
foreach ($globalOptions as $name => $arg) {
$opt = $this->input->getOption(is_numeric($name) ? $arg : $name);
$o = '-' . $opt->short . ' ' . (is_numeric($name) ? '' : '<' . $arg . '>');
$this->output->outputLine(sprintf('%-15s --%-15s %s', $o, $opt->long, $opt->longhelp));
}
$this->output->outputLine();
} else {
$allowed = array_merge($this->commandTree[$command]['options'], $globalOptions);
foreach ($allowed as $name => &$arg) {
if (!is_numeric($name)) {
$arg = $name;
}
}
$unrecognized = array_diff(array_keys($this->input->getOptionValues()), array_values($allowed));
if (!empty($unrecognized)) {
$this->output->outputLine('Invalid options ' . implode(', ', array_map(function ($opt) {
return '-' . $opt;
}, $unrecognized)) . ' will be ignored', 'warning');
}
call_user_func_array(self::$Resque . '::setBackend', array($this->runtime['Redis']['host'] . ':' . $this->runtime['Redis']['port'], $this->runtime['Redis']['database'], $this->runtime['Redis']['namespace']));
if ($this->runtime['Scheduler']['enabled'] === true) {
require_once realpath($this->runtime['Scheduler']['lib'] . DS . 'lib' . DS . 'ResqueScheduler' . DS . 'ResqueScheduler.php');
require_once realpath($this->runtime['Scheduler']['lib'] . DS . 'lib' . DS . 'ResqueScheduler' . DS . 'Stat.php');
}
$this->ResqueStatus = new \ResqueStatus\ResqueStatus(\Resque::Redis());
$this->ResqueStats = new ResqueStats(\Resque::Redis());
$this->{$command}();
}
}
}
示例3: get
public static function get($jobId)
{
$data = Resque::Redis()->get('failed:' . $jobId);
return unserialize($data);
}