/** * Pop a job off the delayed queue for a given timestamp. * * @param DateTime|int $timestamp Instance of DateTime or UNIX timestamp. * @return array Matching job at timestamp. */ public static function nextItemForTimestamp($timestamp) { $timestamp = self::getTimestamp($timestamp); $redis = Resque::redis(); $key = Resque_Redis::getPrefix() . self::SET_KEY; $item = $redis->eval(self::ZPOP_SCRIPT, array($key), array($timestamp)); if (!empty($item)) { return json_decode($item, true); } return false; }
public function testNamespaceNaming() { $fixture = array(array('test' => 'more:than:one:with:', 'assertValue' => 'more:than:one:with:'), array('test' => 'more:than:one:without', 'assertValue' => 'more:than:one:without:'), array('test' => 'resque', 'assertValue' => 'resque:'), array('test' => 'resque:', 'assertValue' => 'resque:')); foreach ($fixture as $item) { Resque_Redis::prefix($item['test']); $this->assertEquals(Resque_Redis::getPrefix(), $item['assertValue']); } }